Skip to content

Commit

Permalink
Use hypothesis.assume to filter out uninteresting test data
Browse files Browse the repository at this point in the history
  • Loading branch information
Askaholic committed Jul 13, 2021
1 parent 88de96e commit 679dc35
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tests/unit_tests/test_matchmaker_algorithm_bucket_teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import random

import pytest
from hypothesis import given
from hypothesis import assume, given
from hypothesis import strategies as st

from server import config
Expand Down Expand Up @@ -45,6 +45,8 @@ def make(
def test_make_teams_single_correct_size(searches, size, make_teams_func):
matched, _ = make_teams_func(searches, size)

assume(matched != [])

for search in matched:
assert len(search.players) == size

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging

import pytest
from hypothesis import given, settings
from hypothesis import assume, given, settings

from server import config
from server.matchmaker import Search
Expand Down Expand Up @@ -168,6 +168,8 @@ def test_stable_marriage_produces_symmetric_matchings(

matches = stable_marriage.StableMarriage().find(ranks)

assume(matches != [])

for search in matches:
opponent = matches[search]
assert matches[opponent] == search
Expand Down

0 comments on commit 679dc35

Please sign in to comment.