def test_is_number_returns_false_for_non_numeric_words(self): self.assertFalse(spellscream.is_number("apple")) self.assertFalse(spellscream.is_number("juice")) self.assertFalse(spellscream.is_number("x86")) self.assertFalse(spellscream.is_number("ARM")) self.assertFalse(spellscream.is_number("bi-tap")) self.assertFalse(spellscream.is_number("left4dead"))
def test_number_detection_on_real_world_numbers(self): self.assertTrue(spellscream.is_number("1")) self.assertTrue(spellscream.is_number("-2")) self.assertTrue(spellscream.is_number("30")) self.assertTrue(spellscream.is_number("4.0")) self.assertTrue(spellscream.is_number("500")) self.assertTrue(spellscream.is_number("6000")) self.assertTrue(spellscream.is_number("7,000")) self.assertTrue(spellscream.is_number("8.000")) self.assertTrue(spellscream.is_number("9,000.00")) self.assertTrue(spellscream.is_number("9.000,00")) self.assertTrue(spellscream.is_number("$9,000.00")) self.assertTrue(spellscream.is_number("$9.000,00")) self.assertTrue(spellscream.is_number("-$9,000.00")) self.assertTrue(spellscream.is_number("-$9.000,00"))
def test_is_number_returns_false_for_empty_string(self): self.assertFalse(spellscream.is_number(""))