def test_dustbin_out_house_waste_garbage(self): garbage = Garbage("House waste garbage") dustbin = Dustbin("red") dustbin.throw_out_garbage(garbage) self.assertEqual(len(dustbin.paper_content), 0) self.assertEqual(len(dustbin.plastic_content), 0) self.assertEqual(len(dustbin.house_waste_content), 1)
def test_dustbin_out_plastic_garbage(self): plastic_garbage = PlasticGarbage("Plastic garbage", True) dustbin = Dustbin("red") dustbin.throw_out_garbage(plastic_garbage) self.assertEqual(len(dustbin.paper_content), 0) self.assertEqual(len(dustbin.plastic_content), 1) self.assertEqual(len(dustbin.house_waste_content), 0)
def test_empty_contents_on_dustbin(self): garbage_list = [ PlasticGarbage("Plastic garbage", True), PaperGarbage("Paper garbage", True), Garbage("House waste garbage") ] dustbin = Dustbin("red") for garbage in garbage_list: dustbin.throw_out_garbage(garbage) dustbin.empty_contents() self.assertEqual(len(dustbin.paper_content), 0) self.assertEqual(len(dustbin.plastic_content), 0) self.assertEqual(len(dustbin.house_waste_content), 0)
def test_dustbin_out_something_which_is_not_a_garbage(self): my_string = "This is NOT a garbage, right???" dustbin = Dustbin("red") self.assertRaises(DustbinContentError, lambda: dustbin.throw_out_garbage(my_string))
def test_dustbin_out_uncleaned_plastic_garbage(self): plastic_garbage = PlasticGarbage("Plastic garbage", False) dustbin = Dustbin("red") self.assertRaises(DustbinContentError, lambda: dustbin.throw_out_garbage(plastic_garbage))
def test_dustbin_out_unsqueezed_paper_garbage(self): paper_garbage = PaperGarbage("Paper garbage", False) dustbin = Dustbin("red") self.assertRaises(DustbinContentError, lambda: dustbin.throw_out_garbage(paper_garbage))