Commits

ubershmekel committed 7735bb5

Small bugfix and test cases for "8ft 3 integers" case.

Comments (0)

Files changed (2)

 
     def foot_and_inch_simple(self):
         text = self.text
-        matcher_re = r'''(\d+)\s*(?:ft|foot|feet)\.?\s+(\d+)\s*(?:in|inches|inch)[\w]*.*$'''
+        matcher_re = r'''(\d+)\s*(?:ft|foot|feet)\.?\s+(\d+)\s*(?:in|inches|inch)(?:[^\w]+|$)'''
         for match in re.finditer(matcher_re, text):
             feet, inches = match.groups()
             # consume the input so it doesn't confuse with the number_unit_conversions

test_metricbot.py

            '''I'm 6'3" 223lbs, so I avoid a lot of confrontations''': '''223 lbs = 101.15 kilograms\n\n6\'3" = 1.91 meters''',
            '20 ft and 1 meter': '', # metric and imperial at same time
            "Sultan Kosen stops growing: World's tallest man reaches his peak at 8ft 3in": '8\'3" = 2.51 meters',
+           "8ft 3 in. ": '8\'3" = 2.51 meters',
+           "8 foot 3 inches": '8\'3" = 2.51 meters',
+           "8ft 3 integers": '8 ft = 2.44 meters',
            }
         
         for text, expected in pairs.items():