Exemplo n.º 1
0
 def losing_abbr(self):
     """
     Returns a ``string`` of the losing team's abbreviation, such as 'WSH'
     for the Washington Capitals.
     """
     if self.winner == HOME:
         return utils._parse_abbreviation(self._away_name)
     return utils._parse_abbreviation(self._home_name)
Exemplo n.º 2
0
 def losing_abbr(self):
     """
     Returns a ``string`` of the losing team's abbreviation, such as 'LAD'
     for the Los Angeles Dodgers.
     """
     if self.winner == HOME:
         return utils._parse_abbreviation(self._away_name)
     return utils._parse_abbreviation(self._home_name)
Exemplo n.º 3
0
 def winning_abbr(self):
     """
     Returns a ``string`` of the winning team's abbreviation, such as 'VEG'
     for the Vegas Golden Knights.
     """
     if self.winner == HOME:
         return utils._parse_abbreviation(self._home_name)
     return utils._parse_abbreviation(self._away_name)
Exemplo n.º 4
0
 def losing_abbr(self):
     """
     Returns a ``string`` of the losing team's abbreviation, such as 'PHO'
     for the Phoenix Suns.
     """
     if self.winner == HOME:
         return utils._parse_abbreviation(self._away_name)
     return utils._parse_abbreviation(self._home_name)
Exemplo n.º 5
0
 def winning_abbr(self):
     """
     Returns a ``string`` of the winning team's abbreviation, such as 'HOU'
     for the Houston Astros.
     """
     if self.winner == HOME:
         return utils._parse_abbreviation(self._home_name)
     return utils._parse_abbreviation(self._away_name)
Exemplo n.º 6
0
 def losing_abbr(self):
     """
     Returns a ``string`` of the losing team's abbreviation, such as 'KAN'
     for the Kansas City Chiefs.
     """
     if self.winner == HOME:
         return utils._parse_abbreviation(self._away_name)
     return utils._parse_abbreviation(self._home_name)
Exemplo n.º 7
0
 def winning_abbr(self):
     """
     Returns a ``string`` of the winning team's abbreviation, such as 'NWE'
     for the New England Patriots.
     """
     if self.winner == HOME:
         return utils._parse_abbreviation(self._home_name)
     return utils._parse_abbreviation(self._away_name)
Exemplo n.º 8
0
 def losing_abbr(self):
     """
     Returns a ``string`` of the losing team's abbreviation, such as
     'GEORGIA' for the Georgia Bulldogs.
     """
     if self.winner == HOME:
         if 'cfb/schools' not in str(self._away_name):
             return self._away_name.text()
         return utils._parse_abbreviation(self._away_name)
     if 'cfb/schools' not in str(self._home_name):
         return self._home_name.text()
     return utils._parse_abbreviation(self._home_name)
Exemplo n.º 9
0
 def losing_abbr(self):
     """
     Returns a ``string`` of the losing team's abbreviation, such as
     'INDIANA' for the Indiana Hoosiers.
     """
     if self.winner == HOME:
         if 'cbb/schools' not in str(self._away_name):
             return str(self._away_name)
         return utils._parse_abbreviation(self._away_name)
     if 'cbb/schools' not in str(self._home_name):
         return str(self._home_name)
     return utils._parse_abbreviation(self._home_name)
Exemplo n.º 10
0
 def winning_abbr(self):
     """
     Returns a ``string`` of the winning team's abbreviation, such as
     'PURDUE' for the Purdue Boilermakers.
     """
     if self.winner == HOME:
         if 'cbb/schools' not in str(self._home_name):
             return str(self._home_name)
         return utils._parse_abbreviation(self._home_name)
     if 'cbb/schools' not in str(self._away_name):
         return str(self._away_name)
     return utils._parse_abbreviation(self._away_name)
Exemplo n.º 11
0
 def winning_abbr(self):
     """
     Returns a ``string`` of the winning team's abbreviation, such as
     'ALABAMA'
     for the Alabama Crimson Tide.
     """
     if self.winner == HOME:
         if 'cfb/schools' not in str(self._home_name):
             return self._home_name.text()
         return utils._parse_abbreviation(self._home_name)
     if 'cfb/schools' not in str(self._away_name):
         return self._away_name.text()
     return utils._parse_abbreviation(self._away_name)
Exemplo n.º 12
0
    def test_abbreviation_is_parsed_correctly(self):
        test_abbreviations = {'/teams/ARI/2018.shtml': 'ARI',
                              '/teams/nwe/2017.htm': 'NWE',
                              '/cfb/schools/clemson/2017.html': 'CLEMSON',
                              '/teams/GSW/2018.html': 'GSW',
                              '/cbb/schools/purdue/2018.html': 'PURDUE',
                              '/teams/TBL/2018.html': 'TBL'}

        for html, abbreviation in test_abbreviations.items():
            mock_html = MockHtml(html, None)
            result = utils._parse_abbreviation(mock_html)
            assert result == abbreviation