-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsample_test.py
More file actions
29 lines (21 loc) · 839 Bytes
/
sample_test.py
File metadata and controls
29 lines (21 loc) · 839 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pytest
import icepool
def test_die_sample():
result = icepool.d6.sample()
assert result >= 1
assert result <= 6
@pytest.mark.skip(reason="sampling expressions not supported for now")
def test_deck_sample():
result = icepool.Deck({'A': 1, 'B': 2, 'C': 3}).sample()
assert result in ['A', 'B', 'C']
@pytest.mark.skip(reason="sampling expressions not supported for now")
def test_pool_sample():
result = icepool.d_pool([6, 6, 6, 8])[:-1].sample()
assert all(x >= 1 for x in result)
assert all(x <= 6 for x in result)
@pytest.mark.skip(
reason="still need to figure out how to sample multiset tuples")
def test_deal_sample():
a, b = icepool.Deck({'A': 1, 'B': 2, 'C': 3}).deal(3, 2).sample()
assert all(x in ['A', 'B', 'C'] for x in a)
assert all(x in ['A', 'B', 'C'] for x in b)