def test_bin_add(): outcome = Outcome("00", 35) bin = Bin( outcome) assert len(bin.outcomes) == 1 #Sets are unique by hash and eq bin.add( Outcome("00", 35) ) assert len(bin.outcomes) == 1 bin.add( Outcome("0", 35) ) assert len(bin.outcomes) == 2
class TestBin(unittest.TestCase): def setUp(self): self.first = Outcome('one', 17) self.second = Outcome('one', 17) self.third = Outcome('two', 32) self.fbin = Bin(self.first) self.sbin = Bin(self.second) def tearDown(self): pass def test___init__(self): self.assertTrue(isinstance(self.fbin, Bin)) def test___str__(self): self.fbin.add(self.third) self.sbin.add(self.third) self.assertEqual(type(' '), type(self.fbin.__str__())) def test_add(self): # bin = Bin(*outcomes) # self.assertEqual(expected, bin.add(outcome)) assert True # TODO: implement your test here
def test_bin_has_outcomes(): outcome_0 = Outcome("0", 35) outcome_5 = Outcome("Five", 6) outcome_00 = Outcome("00", 35) bin_0 = Bin(0) bin_0.add(outcome_0) bin_0.add(outcome_5) bin_00 = Bin(37) bin_00.add(outcome_00) bin_00.add(outcome_5) assert bin_0.outcomes == frozenset([outcome_0, outcome_5]) assert bin_00.outcomes == frozenset([outcome_00, outcome_5])
def testCanAddOutcomeToBin(self): testBin = Bin() self.assertEqual(len(testBin.outcomes), 0) testBin.add(self.output) self.assertEqual(len(testBin.outcomes), 1)
def test_add(self): b1 = Bin() b1.add(o1) self.assertTrue(b1.outcomes == frozenset([o1]))
def testCanAddOutcomeToBin(self): testBin = Bin() self.assertEqual(len(testBin.outcomes), 0) testBin.add(self.output) self.assertEqual(len(testBin.outcomes), 1)