コード例 #1
0
ファイル: test_bell.py プロジェクト: tomnatt/wheatley
 def test_from_index_error(self):
     for i in [-1, MAX_BELL, MAX_BELL + 1, 100, -1100]:
         with self.assertRaises(ValueError):
             Bell.from_index(i)
     # This should be disallowed by the type checker, but may as well test that it does fail
     with self.assertRaises(TypeError):
         Bell.from_index(None)
コード例 #2
0
ファイル: test_bell.py プロジェクト: kneasle/wheatley
 def test_equality(self):
     for i in range(MAX_BELL):
         for j in range(MAX_BELL):
             # Bells with indices `i` and `j` should be equal precisely when `i == j`
             self.assertEqual(Bell.from_index(i) == Bell.from_index(j), i == j)
             # Bells with indices `i` and `j` should be not equal precisely when `i != j`
             self.assertEqual(Bell.from_index(i) != Bell.from_index(j), i != j)
コード例 #3
0
ファイル: test_bell.py プロジェクト: tomnatt/wheatley
 def test_from_index_success(self):
     for i in range(MAX_BELL):
         self.assertEqual(Bell.from_index(i).index, i)