def test_osm_field_different_names(self): field = OSMField(lat_field='some_lat_field', lon_field='some_lon_field') field.set_attributes_from_name("location") formfield = field.formfield() self.assertIsInstance(formfield.widget, OSMWidget) self.assertEqual(formfield.widget.attrs, { 'class': 'osmfield', 'data-lat-field': 'some_lat_field', 'data-lon-field': 'some_lon_field', })
def test_osm_field(self): field = OSMField() field.set_attributes_from_name("location") formfield = field.formfield() self.assertIsInstance(formfield.widget, OSMWidget) self.assertEqual(formfield.widget.attrs, { 'class': 'osmfield', 'data-lat-field': 'location_lat', 'data-lon-field': 'location_lon', })
def test_osm_field_different_names(self): field = OSMField(lat_field="some_lat_field", lon_field="some_lon_field") field.set_attributes_from_name("location") formfield = field.formfield() self.assertIsInstance(formfield.widget, OSMWidget) self.assertEqual( formfield.widget.attrs, { "class": "osmfield", "data-lat-field": "some_lat_field", "data-lon-field": "some_lon_field", }, )