def test_player_name(): reps = search.search(replays, ArgsMock(player='Sarge')) assert len(reps) == 2 and set(x['filename'] for x in reps) == set(['1.sc2replay', '2.sc2replay']) reps = search.search(replays, ArgsMock(player='Anarki')) assert len(reps) == 1 and reps[0]['filename'] == '1.sc2replay' reps = search.search(replays, ArgsMock(player='Sarge', win_only=True)) assert len(reps) == 1 and reps[0]['filename'] == '1.sc2replay'
def test_comp_type(): reps = search.search(replays, ArgsMock(comp_type=['TVP'])) assert len(reps) == 1 and reps[0]['filename'] == '2.sc2replay' reps = search.search(replays, ArgsMock(comp_type=['PVP'])) assert len(reps) == 1 and reps[0]['filename'] == '3.sc2replay' reps = search.search(replays, ArgsMock(comp_type=['TVZ','TVP'])) assert len(reps) == 2 and set(x['filename'] for x in reps) == set(['1.sc2replay', '2.sc2replay'])
def test_strategy(): reps = search.search(replays, ArgsMock(strategy=['PV*: Pylon, Forge, Pylon'])) assert len(reps) == 1 and reps[0]['filename'] == '3.sc2replay' reps = search.search(replays, ArgsMock(strategy=['TVZ: *, Starport within 8:00'])) assert len(reps) == 1 and reps[0]['filename'] == '1.sc2replay' reps = search.search(replays, ArgsMock(strategy=['TVZ: *, Starport within 6:30'])) assert len(reps) == 0 reps = search.search(replays, ArgsMock(strategy=['TVZ: *, 2 Engineering Bay, * Supply Depot, Factory'])) assert len(reps) == 1 and reps[0]['filename'] == '1.sc2replay'
def test_length(): reps = search.search(replays, ArgsMock(min_length=20)) assert len(reps) == 2 and set(x['filename'] for x in reps) == set(['2.sc2replay', '3.sc2replay']) reps = search.search(replays, ArgsMock(max_length=20)) assert len(reps) == 1 and reps[0]['filename'] == '1.sc2replay'