def testPastGame(): expectedResults = ( 'date,team1seed,team1,team1score,team2seed,team2,team2score\n', '03-23-2014,10,Stanford,60,2,Kansas,57\n', '03-23-2014,8,Kentucky,78,1,Wichita State,76\n', '03-23-2014,3,Iowa State,85,6,North Carolina,83\n', '03-23-2014,11,Tennessee,83,14,Mercer,63\n', '03-23-2014,4,UCLA,77,12,Stephen F. Austin,60\n', '03-23-2014,6,Baylor,85,3,Creighton,55\n', '03-23-2014,1,Virginia,78,8,Memphis,60\n', '03-23-2014,1,Arizona,84,8,Gonzaga,61\n', ) monthName = 'March' monthNumber = '03' year = '2014' day = '23' AutomaticFunctions.downloadAndStoreGames(monthName, monthNumber, year, day, 'played', True, 'Tests') testFile = open('Tests/%s/%s/%s-%s-%s_played.csv' % (year, monthName, monthNumber, day, year)) for (expected, actual) in zip(expectedResults, testFile): assert expected == actual
import datetime from datetime import timedelta import AutomaticFunctions import MySqlConnector database = MySqlConnector.MySqlConnector(1, 2014) # TODAY print "Today's upcoming games" monthName = datetime.date.today().strftime('%B') monthNumber = datetime.date.today().strftime('%m') year = datetime.date.today().strftime('%Y') day = datetime.date.today().strftime('%d') AutomaticFunctions.downloadAndStoreGames(monthName, monthNumber, year, day, 'unplayed', False, 'Games') # YESTERDAY print "Yesterday's played games" monthName = (datetime.date.today() - timedelta(1)).strftime('%B') monthNumber = (datetime.date.today() - timedelta(1)).strftime('%m') year = (datetime.date.today() - timedelta(1)).strftime('%Y') day = (datetime.date.today() - timedelta(1)).strftime('%d') AutomaticFunctions.downloadAndStoreGames(monthName, monthNumber, year, day, 'played', True, 'Games')