コード例 #1
0
 def test_is_type_true(self):
     t_liquid = RxType("liquid")
     t_water = RxType("water", t_liquid)
     t_lake = RxType("lake", t_water)
     self.assertTrue(t_water.is_type(t_liquid))
     self.assertTrue(t_lake.is_type(t_water))
     self.assertTrue(t_lake.is_type(t_liquid))
コード例 #2
0
 def test_is_type_false_hierarchy(self):
     t_liquid = RxType("liquid")
     t_water = RxType("water", t_liquid)
     t_lake = RxType("lake", t_water)
     self.assertFalse(t_liquid.is_type(t_water))
     self.assertFalse(t_liquid.is_type(t_lake))
     self.assertFalse(t_water.is_type(t_lake))
コード例 #3
0
 def test_is_type_strict_true(self):
     t_liquid = RxType("liquid")
     t_water = RxType("water", t_liquid)
     t_lake_actual = RxType("lake", t_water)
     t_lake_painting = RxType("lake")
     self.assertTrue(t_lake_actual.is_type(t_lake_painting, strict=True))
     self.assertTrue(t_lake_painting.is_type(t_lake_actual, strict=True))
コード例 #4
0
    def test_is_type_strict_false(self):

        t_liquid = RxType("liquid")
        t_solid = RxType("solid")
        t_water = RxType("water", t_liquid)
        t_lake = RxType("lake", t_water)

        self.assertFalse(t_liquid.is_type(t_water, strict=True))
        self.assertFalse(t_water.is_type(t_liquid, strict=True))

        self.assertFalse(t_water.is_type(t_lake, strict=True))
        self.assertFalse(t_lake.is_type(t_water, strict=True))

        self.assertFalse(t_liquid.is_type(t_lake, strict=True))
        self.assertFalse(t_lake.is_type(t_liquid, strict=True))

        self.assertFalse(t_liquid.is_type(t_solid, strict=True))
        self.assertFalse(t_solid.is_type(t_liquid, strict=True))

        self.assertFalse(t_solid.is_type(t_lake, strict=True))
        self.assertFalse(t_lake.is_type(t_solid, strict=True))
コード例 #5
0
    def test_is_type_false_unrelated(self):
        t_solid = RxType("solid")
        t_liquid = RxType("liquid")
        t_water = RxType("water", t_liquid)
        t_lake = RxType("lake", t_water)

        self.assertFalse(t_liquid.is_type(t_solid))
        self.assertFalse(t_water.is_type(t_solid))
        self.assertFalse(t_lake.is_type(t_solid))

        self.assertFalse(t_solid.is_type(t_liquid))
        self.assertFalse(t_solid.is_type(t_water))
        self.assertFalse(t_solid.is_type(t_lake))