def test_parse_qual_2018(self): with open('test_data/fms_api/2018_week0_qual_breakdown.json', 'r') as f: matches = FMSAPIMatchDetailsParser(2018, 'week0').parse( json.loads(f.read())) self.assertTrue(isinstance(matches, dict)) self.assertEqual(len(matches), 13) # Assert we get enough of each match type clean_matches = MatchHelper.organizeKeys(matches.keys()) self.assertEqual(len(clean_matches["qm"]), 13) # Test gameData self.assertEqual(matches['2018week0_qm1']['red']['tba_gameData'], 'LRL') self.assertEqual(matches['2018week0_qm1']['blue']['tba_gameData'], 'LRL') self.assertEqual(matches['2018week0_qm3']['red']['tba_gameData'], 'RRR') self.assertEqual(matches['2018week0_qm3']['blue']['tba_gameData'], 'RRR') self.assertEqual(matches['2018week0_qm4']['red']['tba_gameData'], 'RLR') self.assertEqual(matches['2018week0_qm4']['blue']['tba_gameData'], 'RLR') self.assertEqual(matches['2018week0_qm8']['red']['tba_gameData'], 'LLL') self.assertEqual(matches['2018week0_qm8']['blue']['tba_gameData'], 'LLL')
def test_parse_qual(self): with open('test_data/fms_api/2016_nyny_qual_breakdown.json', 'r') as f: matches = FMSAPIMatchDetailsParser(2016, 'nyny').parse(json.loads(f.read())) self.assertTrue(isinstance(matches, dict)) self.assertEqual(len(matches), 88) # Assert we get enough of each match type clean_matches = MatchHelper.organizeKeys(matches.keys()) self.assertEqual(len(clean_matches["qm"]), 88)
def test_parse_qual(self): with open('test_data/fms_api/2016_nyny_qual_breakdown.json', 'r') as f: matches = FMSAPIMatchDetailsParser(2016, 'nyny').parse( json.loads(f.read())) self.assertTrue(isinstance(matches, dict)) self.assertEqual(len(matches), 88) # Assert we get enough of each match type clean_matches = MatchHelper.organizeKeys(matches.keys()) self.assertEqual(len(clean_matches["qm"]), 88)
def test_parse_playoff_with_octofinals(self): with open('test_data/fms_api/2016_micmp_staging_playoff_breakdown.json', 'r') as f: matches = FMSAPIMatchDetailsParser(2016, 'micmp').parse(json.loads(f.read())) self.assertTrue(isinstance(matches, dict)) self.assertEquals(len(matches), 36) # Assert we get enough of each match type clean_matches = MatchHelper.organizeKeys(matches.keys()) self.assertEqual(len(clean_matches["ef"]), 20) self.assertEqual(len(clean_matches["qf"]), 10) self.assertEqual(len(clean_matches["sf"]), 4) self.assertEqual(len(clean_matches["f"]), 2)
def test_parse_playoff_with_octofinals(self): with open( 'test_data/fms_api/2016_micmp_staging_playoff_breakdown.json', 'r') as f: matches = FMSAPIMatchDetailsParser(2016, 'micmp').parse( json.loads(f.read())) self.assertTrue(isinstance(matches, dict)) self.assertEquals(len(matches), 36) # Assert we get enough of each match type clean_matches = MatchHelper.organizeKeys(matches.keys()) self.assertEqual(len(clean_matches["ef"]), 20) self.assertEqual(len(clean_matches["qf"]), 10) self.assertEqual(len(clean_matches["sf"]), 4) self.assertEqual(len(clean_matches["f"]), 2)
def test_parse_qual_2018(self): with open('test_data/fms_api/2018_week0_qual_breakdown.json', 'r') as f: matches = FMSAPIMatchDetailsParser(2018, 'week0').parse(json.loads(f.read())) self.assertTrue(isinstance(matches, dict)) self.assertEqual(len(matches), 13) # Assert we get enough of each match type clean_matches = MatchHelper.organizeKeys(matches.keys()) self.assertEqual(len(clean_matches["qm"]), 13) # Test gameData self.assertEqual(matches['2018week0_qm1']['red']['tba_gameData'], 'LRL') self.assertEqual(matches['2018week0_qm1']['blue']['tba_gameData'], 'LRL') self.assertEqual(matches['2018week0_qm3']['red']['tba_gameData'], 'RRR') self.assertEqual(matches['2018week0_qm3']['blue']['tba_gameData'], 'RRR') self.assertEqual(matches['2018week0_qm4']['red']['tba_gameData'], 'RLR') self.assertEqual(matches['2018week0_qm4']['blue']['tba_gameData'], 'RLR') self.assertEqual(matches['2018week0_qm8']['red']['tba_gameData'], 'LLL') self.assertEqual(matches['2018week0_qm8']['blue']['tba_gameData'], 'LLL')