@@ -25,3 +25,39 @@ def test_superclass_name_displayed_after_subclass_name(self, db_editor, db_mngr,
2525 while len (model .root_item .children ) != 2 :
2626 QApplication .processEvents ()
2727 assert [child .display_data for child in model .root_item .children ] == ["Any" , "Object (Any)" ]
28+
29+ def test_entity_items_advertise_they_have_children (self , db_editor , db_mngr , db_map ):
30+ with db_map :
31+ db_map .add_entity_class (name = "A" )
32+ db_map .add_entity (entity_class_name = "A" , name = "a" )
33+ db_map .add_entity_class (name = "B" )
34+ db_map .add_entity (entity_class_name = "B" , name = "b" )
35+ db_map .add_entity_class (dimension_name_list = ["A" , "B" ])
36+ db_map .add_entity (entity_class_name = "A__B" , entity_byname = ["a" , "b" ])
37+ db_map .add_entity_class (dimension_name_list = ["A__B" , "A__B" ])
38+ db_map .add_entity (entity_class_name = "A__B__A__B" , entity_byname = ["a" , "b" , "a" , "b" ])
39+ model = EntityTreeModel (db_editor , db_mngr , db_map )
40+ model .build_tree ()
41+ model .root_item .fetch_more ()
42+ while len (model .root_item .children ) != 4 :
43+ QApplication .processEvents ()
44+ assert [child .display_data for child in model .root_item .children ] == ["A" , "B" , "A__B" , "A__B__A__B" ]
45+ assert all (child .has_children () for child in model .root_item .children )
46+ class_a = model .root_item .children [0 ]
47+ class_a .fetch_more ()
48+ while len (class_a .children ) != 1 :
49+ QApplication .processEvents ()
50+ assert [entity_item .display_data for entity_item in class_a .children ] == ["a" ]
51+ assert all (entity_item .has_children () for entity_item in class_a .children )
52+ entity_a = class_a .children [0 ]
53+ entity_a .fetch_more ()
54+ while len (entity_a .children ) != 1 :
55+ QApplication .processEvents ()
56+ assert [entity_item .display_data for entity_item in entity_a .children ] == ["٭ ǀ b" ]
57+ assert all (entity_item .has_children () for entity_item in entity_a .children )
58+ relationship_a_b = entity_a .children [0 ]
59+ relationship_a_b .fetch_more ()
60+ while len (relationship_a_b .children ) != 1 :
61+ QApplication .processEvents ()
62+ assert [relationship .display_data for relationship in relationship_a_b .children ] == ["٭ ǀ ٭ ǀ ٭ ǀ ٭" ]
63+ assert all (not relationship .has_children () for relationship in relationship_a_b .children )
0 commit comments