Example #1
0
 def test_no_issues(self):
     assert_no_cycles([
         ("State", 'TOP'),
         ("County", "State"),
         ("City", "County"),
         ("Region", "State"),
         ("District", "Region"),
     ])
Example #2
0
 def test_bad_parent_ref(self):
     with self.assertRaises(TreeError) as e:
         assert_no_cycles([
             ("County", "State"),  # State doesn't exist
             ("City", "County"),
             ("Region", "State"),  # State doesn't exist
             ("District", "Region"),
         ])
     self.assertItemsEqual(
         e.exception.affected_nodes,
         ["County", "Region"]
     )
Example #3
0
 def test_has_cycle(self):
     with self.assertRaises(TreeError) as e:
         assert_no_cycles([
             ("State", 'TOP'),
             ("County", "State"),
             ("City", "County"),
             # These three cycle:
             ("Region", "Village"),
             ("District", "Region"),
             ("Village", "District"),
         ])
     self.assertItemsEqual(e.exception.affected_nodes,
                           ["Region", "District", "Village"])
Example #4
0
 def test_has_cycle(self):
     with self.assertRaises(TreeError) as e:
         assert_no_cycles([
             ("State", 'TOP'),
             ("County", "State"),
             ("City", "County"),
             # These three cycle:
             ("Region", "Village"),
             ("District", "Region"),
             ("Village", "District"),
         ])
     self.assertItemsEqual(
         e.exception.affected_nodes,
         ["Region", "District", "Village"]
     )