def test_successful_roll(self): max_roll = 4 gov = Governance("some name", max_roll, 0) for roll in range(1, max_roll + 1): self.assertTrue(gov.is_success(roll)) for roll in range(max_roll + 1, max_roll + 2): self.assertFalse(gov.is_success(roll))
def test_instances_are_hashable(): gov = Governance("anything", 0, 0) hash(gov)
def test_inequality_by_max_roll(self): gov1 = Governance("name 1", 1, 2) gov2 = Governance("name 1", 2, 2) self.assertEqual(gov1, gov2)
def test_inequality_by_name(self): gov1 = Governance("name 1", 0, 1) gov2 = Governance("name 2", 0, 1) self.assertNotEqual(gov1, gov2)
def test_equality(self): name = "some name" max_roll = 3 gov1 = Governance(name, max_roll, 0) gov2 = Governance(name, max_roll, 0) self.assertEquals(gov1, gov2)
def test_repr(self): gov = Governance("Anarchy", 5, -2) self.assertEquals('Governance("Anarchy", 5, -2)', repr(gov))
def test_str(self): gov = Governance("Anarchy", 5, -2) self.assertEquals("Anarchy", str(gov))