TestResult
-- Test Result Proxy¶
API¶
The module for the test result.
TestResult dataclass
¶
Test result for a single test case.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
default_name | str | The default name of the test. | required |
name | str | None | The name of the test. | None |
score | float | None | The score obtained by the test. | None |
max_score | float | None | The max score can obtained for the test. | None |
weight | int | None | The weight of the test. | None |
extra_points | float | None | The extra points of the test, applied when the test is passed. | None |
errors | List[ErrorFormatter] | The errors of the test. | list() |
pass_status | PassStateType | None | The pass status of the test. | None |
hidden | bool | Whether the test is hidden. | False |
descriptions | List[str] | The descriptions of the test. | list() |
Source code in src/gapper/core/test_result.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
rich_test_name property
¶
The name of the test, with the default name prepended if the name is unset.
rich_test_output property
¶
The description output of the test, with the score and max score appended if set.
add_description ¶
Add a description to the test.
New descriptions are added as newlines to the end of the existing descriptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
detail | str | The description to add. | () |
Source code in src/gapper/core/test_result.py
add_error ¶
Add an error to the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
error | ErrorFormatter | The error to add. | required |
set_failed | bool | Whether to set the pass status to failed. | True |
Source code in src/gapper/core/test_result.py
set_default_weight ¶
set_descriptions ¶
Set the description of the test.
This overrides all the existing descriptions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
detail | Iterable[str] | The description to set. | required |
set_extra_points ¶
Set the extra points of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
score | float | None | The extra points of this test case to set. | required |
set_hidden ¶
Set the hidden status of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
hidden | bool | Whether the test is hidden. | required |
set_max_score ¶
Set the max score of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_score | float | None | The max score of this test case to set. | required |
set_name ¶
set_pass_status ¶
Set the pass status of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
status | PassStateType | The pass status to set. | required |
set_score ¶
Set the score of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
score | float | The score to set. | required |
set_weight ¶
Set the weight of the test.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
weight | int | None | The weight of this test case to set. | required |