Exemple #1
0
    def test_not_eq(self):
        a = Sentinel()
        b = Sentinel(a.id, a.name + 'moira')
        self.assertNotEqual(hash(a), hash(b))

        a.id += 'bolivar'
        self.assertNotEqual(hash(a), hash(b))
Exemple #2
0
    def test_eq(self):
        a = Sentinel()
        b = Sentinel(name=a.name)
        self.assertEqual(hash(a), hash(b))

        b.id += 'moira'
        self.assertEqual(hash(a), hash(b))
Exemple #3
0
  def test_invalid_add(self):
    master_mold = MasterMold()

    a = Sentinel()
    b = Sentinel(a.id, a.name)

    master_mold.add_sentinel(a)
    self.assertRaises(sqlite3.IntegrityError, master_mold.add_sentinel, b)
Exemple #4
0
  def test_get(self):
    master_mold = MasterMold()
    master_mold.add_sentinel(Sentinel(id='rockets', name='gas'))
    master_mold.add_sentinel(Sentinel(id='stomp', name='palm beam'))
    master_mold.add_sentinel(Sentinel(id='eye beams', name='bomb'))

    self.assertEqual(len(master_mold.get_sentinels(1)), 1)
    self.assertEqual(len(master_mold.get_sentinels(2)), 2)
    self.assertEqual(len(master_mold.get_sentinels(3)), 3)
    self.assertEqual(len(master_mold.get_sentinels()), 3)
Exemple #5
0
  def test_add_get(self):
    master_mold = MasterMold()
    sentinel = Sentinel()
    master_mold.add_sentinel(sentinel)

    sentinels = master_mold.get_sentinels()
    self.assertEqual(len(sentinels), 1)
    self.assertEqual(sentinels[0], sentinel)
Exemple #6
0
 def test_hash(self):
     a = Sentinel()
     self.assertIsNotNone(hash(a))
Exemple #7
0
 def test_not_eq(self):
     a = Sentinel()
     b = Sentinel(a.id + 'bolivar', a.name + 'moira')
     self.assertNotEqual(a, b)
Exemple #8
0
 def test_eq(self):
     a = Sentinel()
     b = Sentinel(a.id, a.name)
     self.assertEqual(a, b)