def test_get_season(self):
     # Successful
     self.assertEqual(get_season("January 2nd, 2012"), 2011)
     self.assertEqual(get_season("December 2nd, 2012"), 2012)
     # Failure
     self.assertRaises(
             ValueError, get_season, "February 45th, 2001"
             )
Exemple #2
0
 def __parse_title(self):
     """ Parse the title tag from the HTML. This sets the two teams and the
     date."""
     soup = self.soups["title"]
     text = soup.find("title").get_text(strip=True)
     teams = text.split('-')[0]
     fulldate = text.split('-')[1]
     # Parse teams to codes
     (home, away) = convert_title_teams(teams)
     self.json["home team"] = home
     self.home_team = home
     self.json["away team"] = away
     self.away_team = away
     # Parse time
     self.json["datetime"]["date"] = convert_title_date(fulldate)
     self.season = get_season(fulldate)
     self.output_date = get_output_date(fulldate)
 def __parse_title(self):
     """ Parse the title tag from the HTML. This sets the two teams and the
     date."""
     soup = self.soups["title"]
     text = soup.find("title").get_text(strip=True)
     teams = text.split('-')[0]
     fulldate = text.split('-')[1]
     # Parse teams to codes
     (home, away) = convert_title_teams(teams)
     self.json["home team"] = home
     self.home_team = home
     self.json["away team"] = away
     self.away_team = away
     # Parse time
     self.json["datetime"]["date"] = convert_title_date(fulldate)
     self.season = get_season(fulldate)
     self.output_date = get_output_date(fulldate)
Exemple #4
0
 def test_get_season(self):
     # Successful
     self.assertEqual(get_season("January 2nd, 2012"), 2011)
     self.assertEqual(get_season("December 2nd, 2012"), 2012)
     # Failure
     self.assertRaises(ValueError, get_season, "February 45th, 2001")