Exemplo n.º 1
0
 def test_is_of_false_hierarchy(self):
     t_liquid = RxType("liquid")
     t_water = RxType("water", t_liquid)
     t_lake = RxType("lake", t_water)
     type_set = RxTypeSet()
     type_set._types = {"liquid": t_liquid, "water": t_water}
     self.assertFalse(type_set.is_of("liquid", "water"))
     self.assertFalse(type_set.is_of("water", "lake"))
Exemplo n.º 2
0
    def test_is_of_excluded(self):
        t_liquid = RxType("liquid")
        t_water = RxType("water", t_liquid)
        type_set = RxTypeSet()
        type_set._types = {"liquid": t_liquid}

        with self.assertRaises(KeyError):
            type_set.is_of("water", "liquid")
Exemplo n.º 3
0
    def test_is_of_true(self):

        t_liquid = RxType("liquid")
        t_water = RxType("water", t_liquid)
        t_lake = RxType("lake", t_water)
        type_set = RxTypeSet()
        type_set._types = {"water": t_water, "lake": t_lake}
        self.assertTrue(type_set.is_of("water", "liquid"))
        self.assertTrue(type_set.is_of("lake", "water"))
Exemplo n.º 4
0
 def test_is_of_false_unrelated(self):
     t_liquid = RxType("liquid")
     t_solid = RxType("solid")
     type_set = RxTypeSet()
     type_set._types = {"liquid": t_liquid, "solid": t_solid}
     self.assertFalse(type_set.is_of("solid", "liquid"))
     self.assertFalse(type_set.is_of("liquid", "solid"))