Пример #1
0
 def test_hash(self):
     s1 = SynonymType("other", "")
     s2 = SynonymType("other", "something else")
     self.assertEqual(
         hash(s1),
         hash(s2),
     )
Пример #2
0
 def test_eq(self):
     # self == self
     s1 = SynonymType("other", "")
     self.assertEqual(s1, s1)
     # self == other if self.id == other.id
     s2 = SynonymType("other", "something else")
     self.assertEqual(s1, s2)
     # self != anything not a synonym type
     self.assertNotEqual(s1, 1)
Пример #3
0
 def test_lt(self):
     self.assertLess(SynonymType("a", "a"), SynonymType("b", "b"))
     self.assertLess(SynonymType("a", "a"), SynonymType("a", "b"))
     with self.assertRaises(TypeError):
         SynonymType("a", "a") < 2
Пример #4
0
 def test_init_invalid_scope(self):
     with self.assertRaises(ValueError):
         _s = SynonymType(id="other", description="", scope="INVALID")