MCPcopy Create free account
hub / github.com/nlweb-ai/NLWeb / TestResult

Class TestResult

AskAgent/python/testing/base_test_runner.py:53–80  ·  view source on GitHub ↗

Base test result data structure.

Source from the content-addressed store, hash-verified

51
52@dataclass
53class TestResult:
54 """Base test result data structure."""
55 test_case: TestCase
56 success: bool
57 error: str | None = None
58 execution_time: float | None = None
59
60 def to_dict(self) -> dict[str, Any]:
61 """Convert test result to dictionary."""
62 result_dict = {
63 **self.test_case.to_dict(),
64 'success': self.success,
65 'error': self.error,
66 'execution_time': self.execution_time
67 }
68
69 # Add all additional attributes from the test case
70 if hasattr(self.test_case, '__dict__'):
71 for key, value in self.test_case.__dict__.items():
72 if key not in result_dict and not key.startswith('_'):
73 result_dict[key] = value
74
75 # Add all additional attributes from the result
76 for key, value in self.__dict__.items():
77 if key not in ['test_case', 'success', 'error', 'execution_time'] and not key.startswith('_'):
78 result_dict[key] = value
79
80 return result_dict
81
82
83class BaseTestRunner(ABC):

Callers 1

run_testsMethod · 0.85

Calls

no outgoing calls

Tested by 1

run_testsMethod · 0.68