Ejemplo n.º 1
0
 def test_get_digits_from_start_or_end(self):
     string1 = "$12*17"
     assert Commons.get_digits_from_start_or_end(string1) == "17", "Failed to get digits from end"
     string2 = "cos(tan(12+t+15))"
     assert Commons.get_digits_from_start_or_end(string2) is None, "Should not have got any digits from string"
     string3 = "hello"
     assert Commons.get_digits_from_start_or_end(string3) is None, "Did not return None when no calculation found"
     string4 = "£13.50"
     assert Commons.get_digits_from_start_or_end(string4) == "13.50", "Failed to get number from end"
     string5 = "23f234"
     assert Commons.get_digits_from_start_or_end(string5) == "23", "Function should prioritise number at start"
     string6 = "tasty pie"
     assert Commons.get_digits_from_start_or_end(string6) is None, "Should not have got any digits from string"
     string7 = "2e7c"
     assert Commons.get_digits_from_start_or_end(string7) == "2e7", "Function should be able to get e notation"