def test_cleaning_price_should_not_throw_exception(self): raw_price = "" expected = "" result = challenge.clean_price(raw_price) self.assertEqual(expected, result)
def test_cleaning_price_with_dot(self): raw_price = "Por: R$ 3.999,00" expected = 3999.0 result = challenge.clean_price(raw_price) self.assertEqual(expected, result)
def test_cleaning_price_without_dots(self): raw_price = "Por: R$ 42,42" expected = 42.42 result = challenge.clean_price(raw_price) self.assertEqual(expected, result)
def test_get_price_from_html_level_1_challenge(self): html = self.get_html("level1.html") xpath = "//div/text()" expected = 44.99 result = challenge.clean_price(challenge.get_raw_price(html, xpath)) self.assertEqual(expected, result)