コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
 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)
コード例 #4
0
 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)
コード例 #5
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)
コード例 #6
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)
コード例 #7
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))
コード例 #8
0
 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))
コード例 #9
0
 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))
コード例 #10
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))
コード例 #11
0
 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))
コード例 #12
0
 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))