def extract_formulae(self, description): ''' Parses the given description and returns an iterable list of dynamic coordinates with resolved descriptions. ''' assert 'x' not in self._variable_addresses, "'x' as variable name is currently not supported" description = StaticCoordinate.filter(description) description = self._mask_orientation(description) for match in re.finditer(self._dynamic_dimension_re, string=description): normalized_coordinates = self._normalize(match.group()) yield normalized_coordinates
def test_filter_static_coordinates_from_input_with_single_static_dimension(self): given = 'Lorem E 008° 12.345 ipsum' expected = 'Lorem ipsum' actual = StaticCoordinate.filter(given) self.assertEqual(actual, expected)
def test_filter_static_coordinates_from_input_with_static_coordinate(self): given = 'Lorem N 47° 03.204 E 008° 12.345 ipsum' expected = 'Lorem ipsum' actual = StaticCoordinate.filter(given) self.assertEqual(actual, expected)
def test_filter_static_coordinates_from_input_without_static_coordinate(self): given = expected = 'Lorem ipsum' actual = StaticCoordinate.filter(given) self.assertEqual(actual, expected)