Exemplo n.º 1
0
 def testGetSortedMatches(self):
     xml = """
     <model>
         <league id="d1">
             <name>Division 1</name>
         </league>
         <league id="Division2">
             <name>Division 2</name>
             <team id="IBMSouthHants">
                 <name>IBM South Hants</name>
             </team>
             <team id="LocksHeathA">
                 <name>Locks Heath A</name>
             </team>
             <team id="Corinthians">
                 <name>Corinthians</name>
             </team>
             <team id="Curdridge">
                 <name>Curdridge</name>
             </team>
             <team id="Denmead">
                 <name>Denmead</name>
             </team>
             <match>
                 <homeTeam id="LocksHeathA"/>
                 <awayTeam id="IBMSouthHants"/>
                 <date>2013-03-04.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="Denmead"/>
                 <awayTeam id="LocksHeathA"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="LocksHeathA"/>
                 <awayTeam id="Curdridge"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="Corinthians"/>
                 <awayTeam id="LocksHeathA"/>
                 <date>2013-03-12.18:15</date>
                 <pitch>A</pitch>
             </match>
         </league>
     </model>
     """
     root = ElementTree.fromstring(xml)
     teamId = "LocksHeathA"
     generator = TeamFixturesReportGenerator()
     report = generator.getReport(root, teamId)
     result = report.getSortedMatches()
     expectedOpponents = ["Curdridge", "Denmead", "IBM South Hants", "Corinthians"]
     for e, a in zip(expectedOpponents, result):
         self.assertEquals(e, a.opponentName)
     self.assertEquals(len(expectedOpponents), len(result))
Exemplo n.º 2
0
 def testGetReportNoMatchesFound(self):
     xml = """
     <model>
         <league id="d1">
             <name>Division 1</name>
         </league>
         <league id="Division2">
             <name>Division 2</name>
             <team id="IBMSouthHants">
                 <name>IBM South Hants</name>
             </team>
             <team id="LocksHeathA">
                 <name>Locks Heath A</name>
             </team>
             <team id="Corinthians">
                 <name>Corinthians</name>
             </team>
             <team id="Curdridge">
                 <name>Curdridge</name>
             </team>
             <match>
                 <homeTeam id="LocksHeathA"/>
                 <awayTeam id="IBMSouthHants"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="IBMSouthHants"/>
                 <awayTeam id="Corinthians"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="Corinthians"/>
                 <awayTeam id="LocksHeathA"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
         </league>
     </model>
     """
     root = ElementTree.fromstring(xml)
     teamId = "Curdridge"
     generator = TeamFixturesReportGenerator()
     result = generator.getReport(root, teamId)
     self.assertEquals(0, len(result.matches))
     self.assertEquals("Curdridge", result.teamId)
     self.assertEquals("Curdridge", result.teamName)
     self.assertEquals("Division2", result.leagueId)
     self.assertEquals("Division 2", result.leagueName)
Exemplo n.º 3
0
 def testGetReportNoMatchesFound(self):
     xml = """
     <model>
         <league id="d1">
             <name>Division 1</name>
         </league>
         <league id="Division2">
             <name>Division 2</name>
             <team id="IBMSouthHants">
                 <name>IBM South Hants</name>
             </team>
             <team id="LocksHeathA">
                 <name>Locks Heath A</name>
             </team>
             <team id="Corinthians">
                 <name>Corinthians</name>
             </team>
             <team id="Curdridge">
                 <name>Curdridge</name>
             </team>
             <match>
                 <homeTeam id="LocksHeathA"/>
                 <awayTeam id="IBMSouthHants"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="IBMSouthHants"/>
                 <awayTeam id="Corinthians"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="Corinthians"/>
                 <awayTeam id="LocksHeathA"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
         </league>
     </model>
     """
     root = ElementTree.fromstring(xml)
     teamId = "Curdridge"
     generator = TeamFixturesReportGenerator()
     result = generator.getReport(root, teamId)
     self.assertEquals(0, len(result.matches))
     self.assertEquals("Curdridge", result.teamId)
     self.assertEquals("Curdridge", result.teamName)
     self.assertEquals("Division2", result.leagueId)
     self.assertEquals("Division 2", result.leagueName)
Exemplo n.º 4
0
 def testGetSortedMatches(self):
     xml = """
     <model>
         <league id="d1">
             <name>Division 1</name>
         </league>
         <league id="Division2">
             <name>Division 2</name>
             <team id="IBMSouthHants">
                 <name>IBM South Hants</name>
             </team>
             <team id="LocksHeathA">
                 <name>Locks Heath A</name>
             </team>
             <team id="Corinthians">
                 <name>Corinthians</name>
             </team>
             <team id="Curdridge">
                 <name>Curdridge</name>
             </team>
             <team id="Denmead">
                 <name>Denmead</name>
             </team>
             <match>
                 <homeTeam id="LocksHeathA"/>
                 <awayTeam id="IBMSouthHants"/>
                 <date>2013-03-04.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="Denmead"/>
                 <awayTeam id="LocksHeathA"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="LocksHeathA"/>
                 <awayTeam id="Curdridge"/>
                 <date>2013-03-03.18:15</date>
                 <pitch>A</pitch>
             </match>
             <match>
                 <homeTeam id="Corinthians"/>
                 <awayTeam id="LocksHeathA"/>
                 <date>2013-03-12.18:15</date>
                 <pitch>A</pitch>
             </match>
         </league>
     </model>
     """
     root = ElementTree.fromstring(xml)
     teamId = "LocksHeathA"
     generator = TeamFixturesReportGenerator()
     report = generator.getReport(root, teamId)
     result = report.getSortedMatches()
     expectedOpponents = [
         "Curdridge", "Denmead", "IBM South Hants", "Corinthians"
     ]
     for e, a in zip(expectedOpponents, result):
         self.assertEquals(e, a.opponentName)
     self.assertEquals(len(expectedOpponents), len(result))