Ejemplo n.º 1
0
 def testGetCompletedMatchesForDate(self):
     xml = """
     <model>
     <league>
         <name>Hello</name>
         <match>
             <homeTeam id="asad"/>
             <awayTeam id="adasd"/>
             <date>2013-10-30.18:15</date>
             <pitch>A</pitch>
             <playedMatch/>
         </match>
         <match>
             <homeTeam id="asad"/>
             <awayTeam id="adasd"/>
             <date>2013-10-30.17:15</date>
             <pitch>A</pitch>
         </match>
     <league>
     </league>
         <name>Hello</name>
         <match>
             <homeTeam id="asad"/>
             <awayTeam id="adasd"/>
             <date>2013-10-30.19:15</date>
             <pitch>A</pitch>
             <playedMatch/>
         </match>
         <match>
             <homeTeam id="asad"/>
             <awayTeam id="adasd"/>
             <date>2013-10-31.20:15</date>
             <pitch>A</pitch>
             <playedMatch/>
         </match>
     </league>
     </model>
     """
     rootElement = ElementTree.fromstring(xml)
     date = datetime.date(2013, 10, 30)
     generator = ResultsReportGenerator()
     result = generator.getCompletedMatchesForDate(rootElement, date)
     expectedTimes = [datetime.time(18, 15), datetime.time(19, 15)]
     for e, a in zip(sorted([m.time for m in result]),
                     sorted(expectedTimes)):
         self.assertEqual(e, a)
Ejemplo n.º 2
0
 def testGetCompletedMatchesForDate(self):
     xml = """
     <model>
     <league>
         <name>Hello</name>
         <match>
             <homeTeam id="asad"/>
             <awayTeam id="adasd"/>
             <date>2013-10-30.18:15</date>
             <pitch>A</pitch>
             <playedMatch/>
         </match>
         <match>
             <homeTeam id="asad"/>
             <awayTeam id="adasd"/>
             <date>2013-10-30.17:15</date>
             <pitch>A</pitch>
         </match>
     <league>
     </league>
         <name>Hello</name>
         <match>
             <homeTeam id="asad"/>
             <awayTeam id="adasd"/>
             <date>2013-10-30.19:15</date>
             <pitch>A</pitch>
             <playedMatch/>
         </match>
         <match>
             <homeTeam id="asad"/>
             <awayTeam id="adasd"/>
             <date>2013-10-31.20:15</date>
             <pitch>A</pitch>
             <playedMatch/>
         </match>
     </league>
     </model>
     """
     rootElement = ElementTree.fromstring(xml)
     date = datetime.date(2013, 10, 30)
     generator = ResultsReportGenerator()
     result = generator.getCompletedMatchesForDate(rootElement, date)
     expectedTimes = [datetime.time(18, 15), datetime.time(19, 15)]
     for e, a in zip(sorted([m.time for m in result]), sorted(expectedTimes)):
         self.assertEqual(e, a)