def testSetWinLossInfoGamePlayed(self): xml = """ <match> <homeTeam id="HavantA"/> <awayTeam id="HavantB"/> <playedMatch> <teamInMatch> <battingFirst>false</battingFirst> <teamRef id="HavantA"/> <innings> <runsScored>104</runsScored> <wicketsLost>4</wicketsLost> </innings> </teamInMatch> <teamInMatch> <battingFirst>true</battingFirst> <teamRef id="HavantB"/> <innings> <runsScored>112</runsScored> </innings> </teamInMatch> </playedMatch> </match> """ matchElement = ElementTree.fromstring(xml) teamId = "HavantA" generator = TeamFixturesReportGenerator() match = MatchInReport() match.result = None match.margin = None generator.setWinLossInfo(teamId, matchElement, match) self.assertEquals("Lost", match.result) self.assertEquals("8 runs", match.margin)
def testSetWinLossInfoGamePlayed(self): xml = """ <match> <homeTeam id="HavantA"/> <awayTeam id="HavantB"/> <playedMatch> <teamInMatch> <battingFirst>false</battingFirst> <teamRef id="HavantA"/> <innings> <runsScored>104</runsScored> <wicketsLost>4</wicketsLost> </innings> </teamInMatch> <teamInMatch> <battingFirst>true</battingFirst> <teamRef id="HavantB"/> <innings> <runsScored>112</runsScored> </innings> </teamInMatch> </playedMatch> </match> """ matchElement = ElementTree.fromstring(xml) teamId = "HavantA" generator = TeamFixturesReportGenerator() match = MatchInReport() match.result = None match.margin = None generator.setWinLossInfo(teamId, matchElement, match); self.assertEquals("Lost", match.result) self.assertEquals("8 runs", match.margin)
def testSetWinLossInfoGameNotPlayedOrAwarded(self): xml = """ <match/> """ matchElement = ElementTree.fromstring(xml) teamId = "HavantA" generator = TeamFixturesReportGenerator() match = MatchInReport() match.result = None match.margin = None generator.setWinLossInfo(teamId, matchElement, match) self.assertEquals(None, match.result) self.assertEquals(None, match.margin)
def testSetWinLossInfoGameNotPlayedOrAwarded(self): xml = """ <match/> """ matchElement = ElementTree.fromstring(xml) teamId = "HavantA" generator = TeamFixturesReportGenerator() match = MatchInReport() match.result = None match.margin = None generator.setWinLossInfo(teamId, matchElement, match); self.assertEquals(None, match.result) self.assertEquals(None, match.margin)
def testSetWinLossInfoGameAwarded(self): xml = """ <match> <awardedMatch> <winner id="HavantB"/> </awardedMatch> </match> """ matchElement = ElementTree.fromstring(xml) teamId = "HavantA" generator = TeamFixturesReportGenerator() match = MatchInReport() match.result = None match.margin = None generator.setWinLossInfo(teamId, matchElement, match) self.assertEquals("Lost", match.result) self.assertEquals("default", match.margin)
def testSetWinLossInfoGameAwarded(self): xml = """ <match> <awardedMatch> <winner id="HavantB"/> </awardedMatch> </match> """ matchElement = ElementTree.fromstring(xml) teamId = "HavantA" generator = TeamFixturesReportGenerator() match = MatchInReport() match.result = None match.margin = None generator.setWinLossInfo(teamId, matchElement, match); self.assertEquals("Lost", match.result) self.assertEquals("default", match.margin)