<s> import os <EOL> try : <EOL> from urllib . request import urlopen <EOL> except ImportError : <EOL> from urllib2 import urlopen <EOL> def get_test_dir ( ) : <EOL> return os . path . abspath ( os . path . join ( os . path . dirname ( __file__ ) , '<STR_LIT>' ) ) <EOL> def test_url_constants ( ) : <EOL> from rosdep2 . rep3 import REP3_TARGETS_URL <EOL> for url_name , url in [ ( '<STR_LIT>' , REP3_TARGETS_URL ) , <EOL> ] : <EOL> try : <EOL> f = urlopen ( url ) <EOL> f . read ( ) <EOL> f . close ( ) <EOL> except : <EOL> assert False , "<STR_LIT>" % ( url_name , url ) <EOL> def test_download_targets_data ( ) : <EOL> from rosdep2 . rep3 import download_targets_data , REP3_TARGETS_URL <EOL> from rosdep2 import DownloadFailure <EOL> data = download_targets_data ( REP3_TARGETS_URL ) <EOL> assert type ( data ) is dict <EOL> assert '<STR_LIT>' in data <EOL> assert '<STR_LIT>' in data <EOL> assert '<STR_LIT>' in data [ '<STR_LIT>' ] <EOL> assert '<STR_LIT>' in data [ '<STR_LIT>' ] <EOL> try : <EOL> download_targets_data ( targets_url = '<STR_LIT>' ) <EOL> assert False , "<STR_LIT>" <EOL> except DownloadFailure : <EOL> pass </s>
