def test_get_past_game_womens_game(self):
        url = 'https://websites.sportstg.com/comp_info.cgi?c=1-6951-0-522600-0&pool=1&round=14&a=ROUND'
        game = web_scraper.Game(14, 2019, url)
        web_scraper.populate_game_from_sportstg(game)
        self.assertEqual(game.opposition, u'SMOSH West Lakes')
        self.assertEqual(game.is_home_game, False)
        self.assertEqual(game.location, 'Semaphore Park Oval')
        self.assertEqual(
            game.location_url, u'https://websites.sportstg.com/comp_info.cgi?round=14&a=VENUE&venueid=27368027&c=1-6951-0-522600-0&fID=125275487')
        self.assertEqual(game.result, 'LOSS')
        self.assertEqual(game.round, 14)
        self.assertEqual(game.time, u'4:45 PM')
        self.assertEqual(game.date, u'Sat 17 Aug')
        self.assertEqual(game.score_for, u'0.0-0')
        self.assertEqual(game.score_against, u'13.17-95')

        goal_kickers = []
        best_players = [
            {"name": u"R. Gardiner"},
            {"name": u"M. von der Borch-Jardine"},
            {"name": u"M. Williams"},
            {"name": u"M. Lock"},
            {"name": u"B. Badenoch"},
            {"name": u"J. Betts"},
        ]
        self.assertEqual(len(game.goal_kickers), len(goal_kickers))
        self.assertEqual(len(game.best_players), len(best_players))
        for i in range(len(best_players)):
            self.assertEqual(game.best_players[i], best_players[i])
    def test_populate_game_from_sportstg(self):
        round = 2
        year = 2019
        game = web_scraper.Game(round, year, self.url)

        web_scraper.populate_game_from_sportstg(game)

        self.assertEqual(game.opposition, 'Brighton Bombers')
        self.assertEqual(game.image_url,
                         u'http://www-static.spulsecdn.net/pics/00/36/07/46/36074646_1_T.jpg')
        self.assertEqual(game.is_home_game, False)
        self.assertEqual(game.location, 'Brighton Oval')
        self.assertEqual(
            game.location_url, u'https://websites.sportstg.com/comp_info.cgi?round=2&a=VENUE&venueid=26688848&c=1-114-0-510206-0&fID=125234885')
        self.assertEqual(game.result,  'WIN')
        self.assertEqual(game.round, round)
        self.assertEqual(game.time, u'2:15 PM')
        self.assertEqual(game.date, u'Sat 13 Apr')
        self.assertEqual(game.score_for, u'12.13-85')
        self.assertEqual(game.score_against, u'12.9-81')
        goal_kickers = [{'name': u'N. Langridge', 'goals': 4}, {'name': u'C. Parker', 'goals': 2}, {'name': u'R. Marini', 'goals': 1}, {'name': u'M. Langridge', 'goals': 1}, {'name': u'S. Sharley', 'goals': 1}, {'name': u'A. Offe', 'goals': 1}, {'name': u'J. Keynes', 'goals': 1}, {'name': u'M. Slade', 'goals': 1}] 
        best_players = [{'name': u'D. Cunningham'}, {'name': u'C. Parker'}, {'name': u'B. Adams'}, {'name': u'N. Langridge'}, {'name': u'M. Marini'}, {'name': u'A. Offe'}]

        self.assertEqual(len(game.goal_kickers),
                         len(goal_kickers))
        self.assertEqual(len(game.best_players), len(best_players))

        for i in range(len(goal_kickers)):
            self.assertEqual(game.goal_kickers[i], goal_kickers[i])
        for i in range(len(best_players)):
            self.assertEqual(game.best_players[i], best_players[i])
Esempio n. 3
0
    def test_get_future_game_details_2020(self):
        round = 1
        year = 2020
        url = 'https://websites.sportstg.com/comp_info.cgi?c=1-114-0-547208-0&a=ROUND&round=1&pool=1'
        is_final = False
        game = web_scraper.Game(round, year, url, FUTURE_GAME, is_final)

        web_scraper.populate_game_from_sportstg(game)

        self.assertIsNotNone(game)
        self.assertEqual(game.year, 2020)
        self.assertEqual(game.round, 1)
        self.assertEqual(game.opposition, "Unley Mercedes Jets")
        self.assertEqual(game.location, 'Kingswood Oval')
        self.assertEqual(game.time, '2:15 PM')
        self.assertEqual(game.date, u'Sat 4 Jul')
        self.assertEqual(
            game.image_url,
            u'http://www-static.spulsecdn.net/pics/00/36/74/33/36743304_1_T.jpg'
        )
        self.assertEqual(
            game.location_url,
            u'https://websites.sportstg.com/comp_info.cgi?round=1&a=VENUE&venueid=19057075&c=1-114-0-547208-0&fID=125559628'
        )
        self.assertEqual(game.is_home_game, False)
Esempio n. 4
0
    def test_get_future_game_details_forfeit(self):
        round = 4
        year = 2020
        url = 'https://websites.sportstg.com/comp_info.cgi?a=ROUND&round=4&client=1-114-0-557892-0&pool=1'
        game = web_scraper.Game(round, year, url, FUTURE_GAME)

        web_scraper.populate_game_from_sportstg(game)

        self.assertIsNotNone(game)
        self.assertEqual(game.result, 'OPPOSITION_FORFEIT')
Esempio n. 5
0
    def test_get_future_game_details_bye(self):
        round = 6
        year = 2020
        url = 'https://websites.sportstg.com/comp_info.cgi?a=ROUND&round=6&client=1-114-0-547212-0&pool=1'
        game = web_scraper.Game(round, year, url, FUTURE_GAME)

        web_scraper.populate_game_from_sportstg(game)

        self.assertIsNotNone(game)
        self.assertEqual(game.result, 'BYE')
Esempio n. 6
0
    def test_get_future_game_details(self):
        round = 1
        year = 2018
        url = 'http://websites.sportstg.com/comp_info.cgi?c=1-6951-0-522288-0&a=FIXTURE&compID=481797&round=1'
        game = web_scraper.Game(round, year, url, FUTURE_GAME)

        web_scraper.populate_game_from_sportstg(game)

        self.assertIsNotNone(game)
        self.assertEqual(game.year, year)
        self.assertEqual(game.round, round)
        self.assertEqual(game.opposition, u'Morphettville Park')
        self.assertEqual(game.location, u'Kellett Reserve')
 def test_opposition_forfeit(self):
     url = 'https://websites.sportstg.com/comp_info.cgi?c=1-114-0-557892-0&a=ROUND&round=4&pool=1'
     game = web_scraper.Game(4, 2020, url)
     web_scraper.populate_game_from_sportstg(game)
     self.assertEqual(game.opposition, u'Hectorville')
     self.assertEqual(game.is_home_game, True)
     self.assertEqual(game.location, u'Forfeit')
     self.assertEqual(game.result, 'OPPOSITION_FORFEIT')
     self.assertEqual(game.round, 4)
     self.assertEqual(game.date, u'Sat 25 Jul')
     self.assertEqual(game.score_for, u'10.0-60')
     self.assertEqual(game.score_against, u'0.0-0')
     self.assertEqual(game.goal_kickers, '')
     self.assertEqual(game.best_players, '')
Esempio n. 8
0
    def test_get_future_game_details_home_game(self):
        round = 2
        year = 2020
        url = 'https://websites.sportstg.com/comp_info.cgi?a=ROUND&round=2&client=1-114-0-547208-0&pool=1&round=2'
        game = web_scraper.Game(round, year, url, FUTURE_GAME)

        web_scraper.populate_game_from_sportstg(game)

        self.assertIsNotNone(game)
        self.assertEqual(game.year, year)
        self.assertEqual(game.round, round)
        self.assertEqual(game.opposition, "Prince Alfred OC")
        self.assertEqual(game.location, 'University Oval')
        self.assertEqual(game.is_home_game, True)
Esempio n. 9
0
    def test_get_future_game_details_final(self):
        round = 2
        year = 2020
        url = 'https://websites.sportstg.com/comp_info.cgi?a=ROUND&round=2&client=1-114-0-548065-0&pool=1001'
        is_final = True
        game = web_scraper.Game(round, year, url, FUTURE_GAME, is_final)

        web_scraper.populate_game_from_sportstg(game)

        self.assertIsNotNone(game)
        self.assertEqual(game.year, year)
        self.assertEqual(game.round, round)
        self.assertEqual(game.opposition, 'Old Ignatians')
        self.assertEqual(game.location, u'Karen Rolton Oval')
        self.assertEqual(game.is_home_game, False)
 def test_get_past_game_home_game(self):
     url = 'https://websites.sportstg.com/comp_info.cgi?c=1-114-0-510206-0&pool=1&round=3&a=ROUND'
     game = web_scraper.Game(3, 2019, url)
     web_scraper.populate_game_from_sportstg(game)
     self.assertEqual(game.opposition, u'Goodwood Saints')
     self.assertEqual(game.image_url,
                      u'http://www-static.spulsecdn.net/pics/00/02/20/16/2201604_1_T.jpg')
     self.assertEqual(game.is_home_game, True)
     self.assertEqual(game.location, 'University Oval')
     self.assertEqual(
         game.location_url, u'https://websites.sportstg.com/comp_info.cgi?round=3&a=VENUE&venueid=15225989&c=1-114-0-510206-0&fID=125234850')
     self.assertEqual(game.result,  'WIN')
     self.assertEqual(game.round, 3)
     self.assertEqual(game.time, u'2:30 PM')
     self.assertEqual(game.date, u'Thu 25 Apr')
     self.assertEqual(game.score_for, u'13.14-92')
     self.assertEqual(game.score_against, u'8.7-55')
 def test_get_past_game_forfeit_against(self):
     url = 'https://websites.sportstg.com/comp_info.cgi?c=1-6951-0-522600-0&pool=1&round=1&a=ROUND'
     game = web_scraper.Game(1, 2019, url)
     web_scraper.populate_game_from_sportstg(game)
     self.assertEqual(game.result, 'OPPOSITION_FORFEIT')
 def test_bye(self):
     url = 'https://websites.sportstg.com/comp_info.cgi?round=6&a=ROUND&client=1-114-0-547212-0&pool=1'
     game = web_scraper.Game(6, 2020, url)
     web_scraper.populate_game_from_sportstg(game)
     self.assertEqual(game.result, 'BYE')
     self.assertEqual(game.error, '')