formatting fixes, fix a bug when resetting an existing table
This commit is contained in:
+21
-10
@@ -3,26 +3,37 @@ import pytest
|
||||
from rolltable import tables
|
||||
|
||||
|
||||
@pytest.mark.parametrize('table, expected', [
|
||||
(tables.wild_magic, ['A third eye', 'Advantage on perception checks']),
|
||||
(tables.trinkets, ['ivory mimic']),
|
||||
(tables.psychadelic_effects, ['Cosmic', 'mind expands', 'it will become so']),
|
||||
(tables.encounters, ['None', 'Easy', 'Difficult', 'Dangerous', 'Deadly'])
|
||||
])
|
||||
@pytest.mark.parametrize(
|
||||
"table, expected",
|
||||
[
|
||||
(tables.wild_magic, ["A third eye", "Advantage on perception checks"]),
|
||||
(tables.trinkets, ["ivory mimic"]),
|
||||
(tables.psychadelic_effects, ["Cosmic", "mind expands", "it will become so"]),
|
||||
(tables.encounters, ["None", "Easy", "Difficult", "Dangerous", "Deadly"]),
|
||||
],
|
||||
)
|
||||
def test_flat(table, expected):
|
||||
table.die = 1000
|
||||
assert 'd1000' in str(table)
|
||||
assert "d1000" in str(table)
|
||||
for txt in expected:
|
||||
assert txt in str(table)
|
||||
|
||||
|
||||
def test_encounter_frequencies():
|
||||
table = tables.encounters
|
||||
table.die = 1000
|
||||
table.frequency = "none"
|
||||
table.reset()
|
||||
assert "Deadly" not in str(table)
|
||||
|
||||
table.frequency = "deadly"
|
||||
table.reset()
|
||||
assert "Deadly" in str(table)
|
||||
|
||||
|
||||
def test_markdown():
|
||||
tables.trinkets.die = 1
|
||||
md = tables.trinkets.as_markdown()
|
||||
assert '| Roll | Trinket ' in md
|
||||
assert '| ---- |' in md
|
||||
assert 'd1' in md
|
||||
assert "| Roll | Trinket " in md
|
||||
assert "| ---- |" in md
|
||||
assert "d1" in md
|
||||
|
||||
Reference in New Issue
Block a user