<s> from twisted . internet import defer <EOL> from ooni . tests import is_internet_connected , bases <EOL> from ooni import geoip <EOL> class TestGeoIP ( bases . ConfigTestCase ) : <EOL> def test_ip_to_location ( self ) : <EOL> location = geoip . IPToLocation ( '<STR_LIT>' ) <EOL> assert '<STR_LIT>' in location <EOL> assert '<STR_LIT>' in location <EOL> assert '<STR_LIT>' in location <EOL> @ defer . inlineCallbacks <EOL> def test_probe_ip ( self ) : <EOL> if not is_internet_connected ( ) : <EOL> self . skipTest ( <EOL> "<STR_LIT>" <EOL> ) <EOL> probe_ip = geoip . ProbeIP ( ) <EOL> res = yield probe_ip . lookup ( ) <EOL> assert len ( res . split ( '<STR_LIT:.>' ) ) == <NUM_LIT:4> <EOL> def test_geoip_database_version ( self ) : <EOL> version = geoip . database_version ( ) <EOL> assert '<STR_LIT>' in version . keys ( ) <EOL> assert '<STR_LIT>' in version . keys ( ) <EOL> assert len ( version [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) == <NUM_LIT:64> <EOL> assert isinstance ( version [ '<STR_LIT>' ] [ '<STR_LIT>' ] , float ) <EOL> assert len ( version [ '<STR_LIT>' ] [ '<STR_LIT>' ] ) == <NUM_LIT:64> <EOL> assert isinstance ( version [ '<STR_LIT>' ] [ '<STR_LIT>' ] , float ) </s>
