コード例 #1
0
 def test_gamedays(self):
     """
     Test to see if the number of gamedays is between 1 and 34
     """
     crawler.fetch_data(2004, 1, 2005, 1)
     with open('../teamproject/Crawler.csv', encoding='utf8',
               mode='r') as csv_file:
         data = csv.DictReader(csv_file, delimiter=',')
         for row in data:
             assert str((row['Matchday']) > str(0))
             assert str((row['Matchday']) <= str(34))
コード例 #2
0
 def test_teamnames(self):
     """
     Test to check if team1 and team2 are different teams
     """
     try:
         crawler.fetch_data(2004, 1, 2005, 1)
     except:
         raise Exception('Crawler could not fetch selected data.')
     with open('../teamproject/Crawler.csv', encoding='utf8',
               mode='r') as csv_file:
         data = csv.DictReader(csv_file, delimiter=',')
         for row in data:
             assert row['Team1'] != row['Team2']
コード例 #3
0
    def test_date(self):
        """
        Test to see if the year is realistic
        """
        try:
            crawler.fetch_data(2004, 1, 2005, 1)
        except:
            raise Exception('Crawler could not fetch selected data.')

        with open('../teamproject/Crawler.csv', encoding='utf8',
                  mode='r') as csv_file:
            data = csv.DictReader(csv_file, delimiter=',')
            for row in data:
                assert str(row['Date']) <= str(datetime.now())
                assert str(row['Date']) >= str((datetime(2004, 8, 6)))
コード例 #4
0
 def test_goals(self):
     """
     Test to check if the Goals are all equal or bigger than 0 and smaller than 12
     """
     try:
         crawler.fetch_data(2004, 1, 2005, 1)
     except:
         raise Exception('Crawler could not fetch selected data.')
     with open('../teamproject/Crawler.csv', encoding='utf8',
               mode='r') as csv_file:
         data = csv.DictReader(csv_file, delimiter=',')
         for row in data:
             assert str((row['GoalsTeam1']) >= str(0))
             assert str((row['GoalsTeam1']) <= str(12))
             assert str((row['GoalsTeam2']) >= str(0))
             assert str((row['GoalsTeam2']) <= str(12))
コード例 #5
0
def test_fetch_data():
    data = crawler.fetch_data()
    assert isinstance(data, pd.DataFrame)
    assert data.home_score.dtype == 'int64'
    assert data.guest_score.dtype == 'int64'
    assert (data.home_score >= 0).all()
    assert (data.guest_score >= 0).all()
    assert (data.home_team != data.guest_team).all()
コード例 #6
0
def main():
    """
    Creates and shows the main window.
    """
    # Add code here to create and initialize window.

    # For demo purposes, this is how you could access methods from other
    # modules:
    data = fetch_data()
    model = ExperienceAlwaysWins(data)
    winner = model.predict_winner('Tübingen', 'Leverkusen')
    print(winner)