def _test_undef(cc):
     self.assertIs(cc.get_left_set(), Undef())
     self.assertIs(is_functional(cc), Undef())
     self.assertIs(cc.get_right_set(), Undef())
     self.assertIs(is_right_functional(cc), Undef())
     self.assertIs(is_bijective(cc), Undef())
     self.assertIs(is_transitive(cc), Undef())
     self.assertIs(is_equivalence_relation(cc), Undef())
 def _test_undef(cc):
     self.assertIs(cc.get_left_set(), Undef())
     self.assertIs(is_functional(cc), Undef())
     self.assertIs(cc.get_right_set(), Undef())
     self.assertIs(is_right_functional(cc), Undef())
     self.assertIs(is_bijective(cc), Undef())
     self.assertIs(is_transitive(cc), Undef())
     self.assertIs(is_equivalence_relation(cc), Undef())
Exemplo n.º 3
0
 def test_properties(self):
     a = ba['2']
     self.assertIs(a.get_left_set(), Undef())
     self.assertIs(is_functional(a), Undef())
     self.assertIs(a.get_right_set(), Undef())
     self.assertIs(is_right_functional(a), Undef())
     self.assertIs(is_bijective(a), Undef())
     self.assertIs(is_reflexive(a), Undef())
     self.assertIs(is_symmetric(a), Undef())
     self.assertIs(is_transitive(a), Undef())
     self.assertIs(is_equivalence_relation(a), Undef())
 def test_properties(self):
     a = ba['2']
     self.assertIs(a.get_left_set(), Undef())
     self.assertIs(is_functional(a), Undef())
     self.assertIs(a.get_right_set(), Undef())
     self.assertIs(is_right_functional(a), Undef())
     self.assertIs(is_bijective(a), Undef())
     self.assertIs(is_reflexive(a), Undef())
     self.assertIs(is_symmetric(a), Undef())
     self.assertIs(is_transitive(a), Undef())
     self.assertIs(is_equivalence_relation(a), Undef())
Exemplo n.º 5
0
    def test_equivalence_relation(self):
        self.assertTrue(is_equivalence_relation(Set()))
        self.assertFalse(is_equivalence_relation(
            Set([Couplet(s, c) for c, s in zip('aba', 'bcc')])))
        self.assertIs(is_equivalence_relation(Set('a', 'b', 'c')), Undef())
        self.assertFalse(is_equivalence_relation(
            Set([Couplet(s, c) for c, s in zip('aba', 'bcd')])))
        f = is_equivalence_relation(basic_sets['left func'])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_sets['not left func'])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_sets['diagonal'])
        self.assertTrue(f)
        f = is_equivalence_relation(basic_clans['not left func'])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_clans['diagonal'])
        self.assertTrue(f)
        f = is_equivalence_relation(basic_hordes['not left func'])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_hordes['diagonal'])
        self.assertTrue(f)

        s = basic_sets['diagonal']
        self.assertEqual(s.cached_reflexive, CacheStatus.IS)
        self.assertEqual(s.cached_symmetric, CacheStatus.IS)
        self.assertEqual(s.cached_transitive, CacheStatus.IS)
Exemplo n.º 6
0
    def test_equivalence_relation(self):
        self.assertTrue(is_equivalence_relation(Set()))
        self.assertFalse(is_equivalence_relation(Set([Couplet(s, c) for c, s in zip("aba", "bcc")])))
        self.assertIs(is_equivalence_relation(Set("a", "b", "c")), Undef())
        self.assertFalse(is_equivalence_relation(Set([Couplet(s, c) for c, s in zip("aba", "bcd")])))
        f = is_equivalence_relation(basic_sets["left func"])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_sets["not left func"])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_sets["diagonal"])
        self.assertTrue(f)
        f = is_equivalence_relation(basic_clans["not left func"])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_clans["diagonal"])
        self.assertTrue(f)
        f = is_equivalence_relation(basic_hordes["not left func"])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_hordes["diagonal"])
        self.assertTrue(f)

        s = basic_sets["diagonal"]
        self.assertEqual(s.cached_reflexive, CacheStatus.IS)
        self.assertEqual(s.cached_symmetric, CacheStatus.IS)
        self.assertEqual(s.cached_transitive, CacheStatus.IS)
Exemplo n.º 7
0
    def test_equivalence_relation(self):
        self.assertTrue(is_equivalence_relation(Set()))
        self.assertFalse(is_equivalence_relation(
            Set([Couplet(s, c) for c, s in zip('aba', 'bcc')])))
        self.assertIs(is_equivalence_relation(Set('a', 'b', 'c')), Undef())
        self.assertFalse(is_equivalence_relation(
            Set([Couplet(s, c) for c, s in zip('aba', 'bcd')])))
        f = is_equivalence_relation(basic_sets['left func'])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_sets['not left func'])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_sets['diagonal'])
        self.assertTrue(f)
        f = is_equivalence_relation(basic_clans['not left func'])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_clans['diagonal'])
        self.assertTrue(f)
        f = is_equivalence_relation(basic_hordes['not left func'])
        self.assertFalse(f)
        f = is_equivalence_relation(basic_hordes['diagonal'])
        self.assertTrue(f)

        s = basic_sets['diagonal']
        self.assertEqual(s.cached_reflexive, CacheStatus.IS)
        self.assertEqual(s.cached_symmetric, CacheStatus.IS)
        self.assertEqual(s.cached_transitive, CacheStatus.IS)