예제 #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
예제 #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
예제 #3
0
 def test_hemisphere(self, placename, expected):
     lat, lng = places[placename]
     loc = location.Location(lat, lng)
     assert loc.hemisphere == expected
예제 #4
0
 def test_country_indonesia(self):
     lat, lng = 'pontianak'
     loc = location.Location(lat, lng)
     assert loc.country == 'Indonesia'
예제 #5
0
 def test_country_australia(self):
     lat, lng = places['melbourne']
     loc = location.Location(lat, lng)
     assert loc.country == 'Australia'
예제 #6
0
 def test_country_argentina(self):
     lat, lng = places['buenos aires']
     loc = location.Location(lat, lng)
     assert loc.country == 'Argentina'
예제 #7
0
 def test_country_russia(self):
     lat, lng = places['murmansk']
     loc = location.Location(lat, lng)
     assert loc.country == 'Russian Federation'
예제 #8
0
 def test_country_uk(self):
     lat, lng = places['london']
     loc = location.Location(lat, lng)
     assert loc.country == 'UK'
예제 #9
0
 def test_hemisphere_melbourne(self):
     lat, lng = places['melbourne']
     loc = location.Location(lat, lng)
     assert loc.hemisphere == 'northern'
예제 #10
0
 def test_country_india(self):
     lat, lng = places['delhi']
     loc = location.Location(lat, lng)
     assert loc.country == 'India'