if product == "W": win_pool.updatePool(int(stake), selections) elif product == "P": place_pool.updatePool(int(stake), selections) elif product == "E": exacta_pool.updatePool(int(stake), selections) else: print "Invalid input as a Bet: ", line break elif break_down[0] == "Result": # No need for a result class as well # Assume that selection is not started with '0', e.g. '03' first = break_down[1] second = break_down[2] third = break_down[3] if utils.isValidResult(first, second, third): # Print dividend win_pool.printDividend(first) place_pool.printDividends(first, second, third) exacta_pool.printDividend(first + "," + second) # clear the pool after the dividends are printed in case there is more input coming (if there is any) win_pool.clearPool() place_pool.clearPool() exacta_pool.clearPool() else: print "Invalid Input as a Result: ", line break else: print "Invalid input", line break
def test_isValidResult(self): self.assertTrue(utils.isValidResult('3','1','4')) self.assertFalse(utils.isValidResult('3','1','4DDD')) self.assertFalse(utils.isValidResult('3','1','3'))