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)
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)
def test_from_index_success(self): for i in range(MAX_BELL): self.assertEqual(Bell.from_index(i).index, i)