Skip to content

Commit 33a580a

Browse files
authored
Add coclustering report edge cases for ill-formed 'intervals' (#487)
- test for no interval - test for single-interval which contains missing values
1 parent ce5f03d commit 33a580a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

tests/test_core.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,31 @@ def test_coclustering_results_simple_edge_cases(self):
15841584
dimension.init_summary(json_data="NOT A DICT")
15851585
with self.assertRaises(TypeError):
15861586
dimension.init_partition(json_data="NOT A DICT")
1587+
dimension.init_summary(json_data={"name": "PartName", "type": "Numerical"})
1588+
with self.assertRaises(kh.KhiopsJSONError) as cm:
1589+
dimension.init_partition(
1590+
json_data={
1591+
"name": dimension.name,
1592+
"type": dimension.type,
1593+
"intervals": [],
1594+
}
1595+
)
1596+
self.assertIn(
1597+
"'intervals' key must have length at least 1", cm.exception.args[0]
1598+
)
1599+
with self.assertRaises(kh.KhiopsJSONError) as cm:
1600+
dimension.init_partition(
1601+
json_data={
1602+
"name": dimension.name,
1603+
"type": dimension.type,
1604+
"intervals": [None],
1605+
}
1606+
)
1607+
self.assertIn(
1608+
"'intervals' key must have at least 2 elements when one element "
1609+
"contains missing values",
1610+
cm.exception.args[0],
1611+
)
15871612
with self.assertRaises(TypeError):
15881613
dimension.init_hierarchy(json_data="NOT A DICT")
15891614
with self.assertRaises(TypeError):

0 commit comments

Comments
 (0)