示例#1
0
    def test_equals(self):
        code1 = Code(self.test_product_1)
        code2 = Code(self.test_product_2)

        self.assertFalse(code1 == code2)

        code1.code = "123"
        code2.code = "123"

        self.assertTrue(code1 == code2)
示例#2
0
    def test_add_number(self):
        code = Code(EmptyProduct())
        code.code = "123"

        self.assertEqual(code.code, "123")

        code.add_number("4")
        self.assertEqual(code.code, "1234")

        code.add_number(5)
        self.assertEqual(code.code, "12345")

        code.add_number("")
        self.assertEqual(code.code, "12345")