Pull out matching functions into their own file
This commit is contained in:
parent
331677ad09
commit
6fbb598886
5 changed files with 84 additions and 44 deletions
21
matching_test.py
Normal file
21
matching_test.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
"""
|
||||
Test functions for Matchy
|
||||
"""
|
||||
import discord
|
||||
import pytest
|
||||
import matching
|
||||
|
||||
|
||||
@pytest.mark.parametrize("matchees, per_group", [
|
||||
([discord.Member.__new__(discord.Member)] * 100, 3),
|
||||
([discord.Member.__new__(discord.Member)] * 12, 5),
|
||||
([discord.Member.__new__(discord.Member)] * 11, 2),
|
||||
([discord.Member.__new__(discord.Member)] * 356, 8),
|
||||
])
|
||||
def test_matchees_to_groups(matchees, per_group):
|
||||
"""Test simple group matching works"""
|
||||
groups = matching.objects_to_groups(matchees, per_group)
|
||||
for group in groups:
|
||||
# Ensure the group contains the right number of members
|
||||
assert len(group) >= per_group
|
||||
assert len(group) < per_group*2
|
Loading…
Add table
Add a link
Reference in a new issue