def setUp(self): self.submit_buttons = SubmitButtons() self.test_code_plu = Code( Product(code="123", name="None", quantity_type="szt")) self.test_code_waga = Code( Product(code="123", name="None", quantity_type="kg"))
def make_result(self, number): """ :param number: :type number: int :return: tuple """ passed = True picked_code = Code(Product( code=str(number), name="Prod " + str(number), quantity_type="kg")) if number % 2 == 1: number = 100 - number passed = False entered_code = Code(Product( code=str(number), name="Prod " + str(number), quantity_type="kg")) return ( picked_code, entered_code, passed )
def setUp(self): self.test_product_1 = Product(code="123456", name="Product 1", quantity_type="szt") self.test_product_2 = Product(code="234", name="Product 2", quantity_type="kg") pass
def test_product_from_args(self): product = Product( name="Ryba", quantity_type="szt", code="123" ) self.assertEqual(product.name, "Ryba") self.assertEqual(product.code, "123") self.assertEqual(product.quantity_type, "szt")
def test_product_from_list(self): product = Product([ "Ryba", "szt", "123" ]) self.assertEqual(product.name, "Ryba") self.assertEqual(product.code, "123") self.assertEqual(product.quantity_type, "szt")
def setUp(self): self.test_product = Product( code="1", name="Test Product", quantity_type="szt" ) self.test_product2 = Product( code="123", name="Test Product", quantity_type="szt" ) self.test_product3 = Product( code="3", name="Test Product", quantity_type="szt" ) self.test_code = Code(self.test_product) self.test_code2 = Code(self.test_product2) self.test_code3 = Code(self.test_product3) self.cm = CodeManager() self.cm.pick_product = Mock(return_value=self.test_code) self.product_name = ProductName() self.product_code = ProductCode() self.screen_keyboard = ScreenKeyboard() self.submit_buttons = SubmitButtons() self.learn = LearningWorkflow( cm = self.cm, product_code=self.product_code, product_name=self.product_name, screen_keyboard=self.screen_keyboard, submit_buttons=self.submit_buttons ) pass
def pick_random(self): type = self.pick_type() return Product(random.choice(self.products[type]))