mirror of
https://github.com/tgorordo/smithy.git
synced 2026-06-12 18:42:13 -07:00
init. core algorithm, initial testing, basic cli.
This commit is contained in:
commit
8836c49091
12 changed files with 2297 additions and 0 deletions
35
test/test_rcvs.py
Normal file
35
test/test_rcvs.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import polars as pl
|
||||
from smithy import smith_set
|
||||
|
||||
def test_condorcet():
|
||||
df = pl.DataFrame({
|
||||
'A': [1, 1, 2, 1],
|
||||
'B': [2, 2, 1, 2],
|
||||
'C': [3, 3, 3, 3],
|
||||
})
|
||||
assert smith_set(df) == ['A']
|
||||
|
||||
def test_rockpprscrcycle():
|
||||
df = pl.DataFrame({
|
||||
'A': [1, 2, 3],
|
||||
'B': [2, 3, 1],
|
||||
'C': [3, 1, 2],
|
||||
})
|
||||
assert smith_set(df) == ['A', 'B', 'C']
|
||||
|
||||
def test_abpair():
|
||||
df = pl.DataFrame({
|
||||
"A": [1, 2, 1, 3],
|
||||
"B": [2, 1, 3, 1],
|
||||
"C": [3, 3, 2, 2]
|
||||
})
|
||||
assert smith_set(df) == ['A', 'B']
|
||||
|
||||
def test_fourcycle():
|
||||
df = pl.DataFrame({
|
||||
"A": [1,2,3,4],
|
||||
"B": [2,3,4,1],
|
||||
"C": [3,4,1,2],
|
||||
"D": [4,1,2,3],
|
||||
})
|
||||
assert smith_set(df) == ['A', 'B', 'C', 'D']
|
||||
Loading…
Add table
Add a link
Reference in a new issue