|
6 | 6 | ColumnMetadata, |
7 | 7 | ResultType, |
8 | 8 | ValidationRule, |
9 | | - GenericResultTable, |
| 9 | + GenericResultTable, Cell, |
10 | 10 | ) |
11 | 11 |
|
12 | 12 |
|
@@ -222,3 +222,33 @@ class Meta: |
222 | 222 |
|
223 | 223 | with pytest.raises(ValueError, match="TEXT"): |
224 | 224 | TextType() |
| 225 | + |
| 226 | + |
| 227 | +@pytest.mark.parametrize("clazz", [ |
| 228 | + pytest.param(GenericResultTable, id="GenericResultTable"), |
| 229 | + pytest.param(StaticGenericResultTable, id="StaticGenericResultTable"), |
| 230 | +]) |
| 231 | +def test_all_parameters(clazz): |
| 232 | + """ |
| 233 | + Tests that all parameters can be passed through constructor |
| 234 | + """ |
| 235 | + results = clazz(name="test", |
| 236 | + description="test", |
| 237 | + columns=[ |
| 238 | + ColumnMetadata(name="column2", unit="unit1", type=ResultType.INTEGER, higher_is_better=True), |
| 239 | + ], |
| 240 | + validation_rules={"column2": ValidationRule(best_pct=10, best_abs=20, fixed_limit=30)}, |
| 241 | + sut_timestamp=10, |
| 242 | + results=[ |
| 243 | + Cell(column='column2', row="1", value=2.86, status=Status.UNSET) |
| 244 | + ], |
| 245 | + sut_package_name="test package") |
| 246 | + |
| 247 | + serialized = results.as_dict() |
| 248 | + |
| 249 | + assert serialized["meta"]["name"] == "test" |
| 250 | + assert serialized["meta"]["description"] == "test" |
| 251 | + assert len(serialized["meta"]["rows_meta"]) == 1 |
| 252 | + assert len(serialized["meta"]["columns_meta"]) == 1 |
| 253 | + assert len(serialized["meta"]["validation_rules"]) == 1 |
| 254 | + assert len(serialized["results"]) == 1 |
0 commit comments