Exemplo n.º 1
0
 def test_hemisphere_errors(self):
     """We don't validate the input, but we expect
     lat and lng to be floats rather than eg strings.
     It's not exactly intentional, but this test is
     documenting that behaviour.
     """
     lat = '37°S'
     lng = '144°E'
     loc = location.Location(lat, lng)
     with pytest.raises(TypeError):
         _hemisphere = loc.hemisphere
Exemplo n.º 2
0
    def get_form(self, step=None, data=None, files=None):
        form = super(EventWizard, self).get_form(step, data, files)

        # determine the step if not given
        if step is None:
            step = self.steps.current

        if step == '1':
            latlng = self.get_cleaned_data_for_step('0')['location']
            calendars = seasons.get_valid_calendars(location.Location(*latlng))
            choices = [(c.name, c.name) for c in calendars]
            form.fields['calendar'] = forms.ChoiceField(
                choices=choices, widget=forms.RadioSelect)

        return form
Exemplo n.º 3
0
 def test_hemisphere(self, placename, expected):
     lat, lng = places[placename]
     loc = location.Location(lat, lng)
     assert loc.hemisphere == expected
Exemplo n.º 4
0
 def test_country_indonesia(self):
     lat, lng = 'pontianak'
     loc = location.Location(lat, lng)
     assert loc.country == 'Indonesia'
Exemplo n.º 5
0
 def test_country_australia(self):
     lat, lng = places['melbourne']
     loc = location.Location(lat, lng)
     assert loc.country == 'Australia'
Exemplo n.º 6
0
 def test_country_argentina(self):
     lat, lng = places['buenos aires']
     loc = location.Location(lat, lng)
     assert loc.country == 'Argentina'
Exemplo n.º 7
0
 def test_country_russia(self):
     lat, lng = places['murmansk']
     loc = location.Location(lat, lng)
     assert loc.country == 'Russian Federation'
Exemplo n.º 8
0
 def test_country_uk(self):
     lat, lng = places['london']
     loc = location.Location(lat, lng)
     assert loc.country == 'UK'
Exemplo n.º 9
0
 def test_hemisphere_melbourne(self):
     lat, lng = places['melbourne']
     loc = location.Location(lat, lng)
     assert loc.hemisphere == 'northern'
Exemplo n.º 10
0
 def test_country_india(self):
     lat, lng = places['delhi']
     loc = location.Location(lat, lng)
     assert loc.country == 'India'