<s> from django import test <EOL> from django . core import exceptions <EOL> from django_google_maps import fields <EOL> class GeoPtFieldTests ( test . TestCase ) : <EOL> def test_sets_lat_lon_on_initialization ( self ) : <EOL> geo_pt = fields . GeoPt ( "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT> , geo_pt . lat ) <EOL> self . assertEqual ( <NUM_LIT> , geo_pt . lon ) <EOL> def test_uses_lat_comma_lon_as_unicode_representation ( self ) : <EOL> lat_lon_string = "<STR_LIT>" <EOL> geo_pt = fields . GeoPt ( lat_lon_string ) <EOL> self . assertEqual ( lat_lon_string , unicode ( geo_pt ) ) <EOL> def test_two_GeoPts_with_same_lat_lon_should_be_equal ( self ) : <EOL> geo_pt_1 = fields . GeoPt ( "<STR_LIT>" ) <EOL> geo_pt_2 = fields . GeoPt ( "<STR_LIT>" ) <EOL> self . assertEqual ( geo_pt_1 , geo_pt_2 ) <EOL> def test_two_GeoPts_with_different_lat_should_not_be_equal ( self ) : <EOL> geo_pt_1 = fields . GeoPt ( "<STR_LIT>" ) <EOL> geo_pt_2 = fields . GeoPt ( "<STR_LIT>" ) <EOL> self . assertNotEqual ( geo_pt_1 , geo_pt_2 ) <EOL> def test_two_GeoPts_with_different_lon_should_not_be_equal ( self ) : <EOL> geo_pt_1 = fields . GeoPt ( "<STR_LIT>" ) <EOL> geo_pt_2 = fields . GeoPt ( "<STR_LIT>" ) <EOL> self . assertNotEqual ( geo_pt_1 , geo_pt_2 ) <EOL> def test_is_not_equal_when_comparison_is_not_GeoPt_object ( self ) : <EOL> geo_pt_1 = fields . GeoPt ( "<STR_LIT>" ) <EOL> geo_pt_2 = "<STR_LIT>" <EOL> self . assertNotEqual ( geo_pt_1 , geo_pt_2 ) <EOL> def test_allows_GeoPt_instantiated_with_empty_string ( self ) : <EOL> geo_pt = fields . GeoPt ( '<STR_LIT>' ) <EOL> self . assertEqual ( None , geo_pt . lat ) <EOL> self . assertEqual ( None , geo_pt . lon ) <EOL> def test_uses_empty_string_as_unicode_representation_for_empty_GeoPt ( self ) : <EOL> geo_pt = fields . GeoPt ( '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT>' , unicode ( geo_pt ) ) <EOL> def test_splits_geo_point_on_comma ( self ) : <EOL> pt = fields . GeoPt ( "<STR_LIT>" ) <EOL> self . assertEqual ( '<STR_LIT>' , str ( pt . lat ) ) <EOL> self . assertEqual ( '<STR_LIT>' , str ( pt . lon ) ) <EOL> def test_raises_error_when_attribute_error_on_split ( self ) : <EOL> class Fake ( object ) : <EOL> pass <EOL> with self . assertRaises ( exceptions . ValidationError ) : <EOL> fields . GeoPt ( Fake ) <EOL> def test_raises_error_when_type_error_on_split ( self ) : <EOL> with self . assertRaises ( exceptions . ValidationError ) : <EOL> x , y = fields . GeoPt ( "<STR_LIT>" ) <EOL> def test_returns_float_value_when_valid_value ( self ) : <EOL> geo_pt = fields . GeoPt ( '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT> , geo_pt . lat ) <EOL> def test_raises_exception_when_value_is_out_of_upper_range ( self ) : <EOL> with self . assertRaises ( exceptions . ValidationError ) : <EOL> fields . GeoPt ( '<STR_LIT>' ) <EOL> def test_raises_exception_when_value_is_out_of_lower_range ( self ) : <EOL> with self . assertRaises ( exceptions . ValidationError ) : <EOL> fields . GeoPt ( '<STR_LIT>' ) <EOL> def test_len_returns_len_of_unicode_value ( self ) : <EOL> geo_pt = fields . GeoPt ( "<STR_LIT>" ) <EOL> self . assertEqual ( <NUM_LIT:9> , len ( geo_pt ) ) </s>
