-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathformat_test.py
More file actions
39 lines (29 loc) · 775 Bytes
/
format_test.py
File metadata and controls
39 lines (29 loc) · 775 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
30
31
32
33
34
35
36
37
38
39
import icepool
import pytest
test_dice = [icepool.Die([]), icepool.d6, icepool.d6.map(lambda x: (x, x + 1))]
# Test against errors only.
@pytest.mark.parametrize('die', test_dice)
def test_repr(die):
repr(die)
@pytest.mark.parametrize('die', test_dice)
def test_str(die):
str(die)
format_specs = [
'',
'md:q==|q<=|q>=',
'md:p==|p<=|p>=',
'md:%==|%>=|%>=',
'csv:q==|q<=|q>=',
'csv:p==|p<=|p>=',
'csv:%==|%>=|%>=',
'bbcode:q==|q<=|q>=',
'bbcode:p==|p<=|p>=',
'bbcode:%==|%>=|%>=',
'html:q==|q<=|q>=',
'html:p==|p<=|p>=',
'html:%==|%>=|%>=',
]
@pytest.mark.parametrize('die', test_dice)
@pytest.mark.parametrize('format_spec', format_specs)
def test_format_spec(die, format_spec):
f'{die:{format_spec}}'