<s> import sys <EOL> import unittest <EOL> from os import environ <EOL> import soccermetrics <EOL> from soccermetrics import SoccermetricsException <EOL> from soccermetrics . rest import SoccermetricsRestClient , find_credentials <EOL> if sys . version_info [ : <NUM_LIT:2> ] == ( <NUM_LIT:2> , <NUM_LIT:6> ) : <EOL> def assertIsInstance ( self , obj , cls , msg = None ) : <EOL> if not isinstance ( obj , cls ) : <EOL> standardMsg = '<STR_LIT>' % ( safe_repr ( obj ) , cls ) <EOL> self . fail ( self . _formatMessage ( msg , standardMsg ) ) <EOL> unittest . TestCase . assertIsInstance = assertIsInstance <EOL> class NoCredentialsTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> if '<STR_LIT>' in environ . keys ( ) : <EOL> del environ [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in environ . keys ( ) : <EOL> del environ [ '<STR_LIT>' ] <EOL> def test_no_credentials ( self ) : <EOL> """<STR_LIT>""" <EOL> account , api_key = find_credentials ( ) <EOL> self . assertEqual ( account , None ) <EOL> self . assertEqual ( api_key , None ) <EOL> class PartialCredentialsTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> environ [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if '<STR_LIT>' in environ . keys ( ) : <EOL> del environ [ '<STR_LIT>' ] <EOL> def test_partial_credentials ( self ) : <EOL> """<STR_LIT>""" <EOL> account , api_key = find_credentials ( ) <EOL> self . assertEqual ( account , None ) <EOL> self . assertEqual ( api_key , None ) <EOL> class FullCredentialsTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> environ [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> environ [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> def test_full_credentials ( self ) : <EOL> """<STR_LIT>""" <EOL> account , api_key = find_credentials ( ) <EOL> self . assertEqual ( account , '<STR_LIT>' ) <EOL> self . assertEqual ( api_key , '<STR_LIT>' ) <EOL> class RestClientTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> if '<STR_LIT>' in environ . keys ( ) : <EOL> del environ [ '<STR_LIT>' ] <EOL> if '<STR_LIT>' in environ . keys ( ) : <EOL> del environ [ '<STR_LIT>' ] <EOL> def test_fail_connect ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( SoccermetricsException , SoccermetricsRestClient ) <EOL> def test_connect ( self ) : <EOL> """<STR_LIT>""" <EOL> self . client = SoccermetricsRestClient ( account = "<STR_LIT>" , api_key = "<STR_LIT>" ) <EOL> self . assertIsInstance ( self . client , SoccermetricsRestClient ) <EOL> class RestClientAttributeTest ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . client = SoccermetricsRestClient ( account = "<STR_LIT>" , api_key = "<STR_LIT>" ) <EOL> def test_https_endpoint ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertTrue ( self . client . root . base_uri . startswith ( "<STR_LIT>" ) ) <EOL> def test_service_root ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertIsInstance ( self . client . root , soccermetrics . rest . resources . Root ) <EOL> def test_link ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertIsInstance ( self . client . link , soccermetrics . rest . resources . Link ) <EOL> def test_validation ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertIsInstance ( self . client . validation . confederations , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . countries , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . competitions , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . domesticCompetitions , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . intlCompetitions , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . seasons , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . teams , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . venues , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . nameOrder , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . persons , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . positions , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . fouls , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . cards , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . bodyparts , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . shotevents , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . penaltyOutcomes , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . actions , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . modifiers , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . modifierCategories , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . weather , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> self . assertIsInstance ( self . client . validation . surfaces , <EOL> soccermetrics . rest . resources . validation . ValidationResource ) <EOL> def test_personnel ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertIsInstance ( self . client . players , <EOL> soccermetrics . rest . resources . Personnel ) <EOL> self . assertIsInstance ( self . client . managers , <EOL> soccermetrics . rest . resources . Personnel ) <EOL> self . assertIsInstance ( self . client . referees , <EOL> soccermetrics . rest . resources . Personnel ) <EOL> def test_club ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertIsInstance ( self . client . club , <EOL> soccermetrics . rest . resources . MatchPlay ) <EOL> self . assertIsInstance ( self . client . club . information , <EOL> soccermetrics . rest . resources . match . MatchInformation ) <EOL> self . assertIsInstance ( self . client . club . lineups , <EOL> soccermetrics . rest . resources . match . MatchLineups ) <EOL> self . assertIsInstance ( self . client . club . conditions , <EOL> soccermetrics . rest . resources . match . MatchConditions ) <EOL> self . assertIsInstance ( self . client . club . goals , <EOL> soccermetrics . rest . resources . match . MatchGoals ) <EOL> self . assertIsInstance ( self . client . club . penalties , <EOL> soccermetrics . rest . resources . match . MatchPenalties ) <EOL> self . assertIsInstance ( self . client . club . offenses , <EOL> soccermetrics . rest . resources . match . MatchOffenses ) <EOL> self . assertIsInstance ( self . client . club . substitutions , <EOL> soccermetrics . rest . resources . match . MatchSubstitutions ) <EOL> self . assertIsInstance ( self . client . club . shootouts , <EOL> soccermetrics . rest . resources . match . MatchShootouts ) <EOL> self . assertIsInstance ( self . client . club . stats , <EOL> soccermetrics . rest . resources . statistics . MatchStatistics ) <EOL> self . assertIsInstance ( self . client . club . events , <EOL> soccermetrics . rest . resources . events . MatchEvents ) <EOL> def test_natl ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertIsInstance ( self . client . natl , <EOL> soccermetrics . rest . resources . MatchPlay ) <EOL> self . assertIsInstance ( self . client . natl . information , <EOL> soccermetrics . rest . resources . match . MatchInformation ) <EOL> self . assertIsInstance ( self . client . natl . lineups , <EOL> soccermetrics . rest . resources . match . MatchLineups ) <EOL> self . assertIsInstance ( self . client . natl . conditions , <EOL> soccermetrics . rest . resources . match . MatchConditions ) <EOL> self . assertIsInstance ( self . client . natl . goals , <EOL> soccermetrics . rest . resources . match . MatchGoals ) <EOL> self . assertIsInstance ( self . client . natl . penalties , <EOL> soccermetrics . rest . resources . match . MatchPenalties ) <EOL> self . assertIsInstance ( self . client . natl . offenses , <EOL> soccermetrics . rest . resources . match . MatchOffenses ) <EOL> self . assertIsInstance ( self . client . natl . substitutions , <EOL> soccermetrics . rest . resources . match . MatchSubstitutions ) <EOL> self . assertIsInstance ( self . client . natl . shootouts , <EOL> soccermetrics . rest . resources . match . MatchShootouts ) <EOL> self . assertIsInstance ( self . client . natl . stats , <EOL> soccermetrics . rest . resources . statistics . MatchStatistics ) <EOL> self . assertIsInstance ( self . client . natl . events , <EOL> soccermetrics . rest . resources . events . MatchEvents ) <EOL> def test_analytics ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertIsInstance ( self . client . analytics , <EOL> soccermetrics . rest . resources . MatchAnalytics ) </s>
