adding importable roll tables and generative CLI

This commit is contained in:
evilchili
2024-01-17 21:15:39 -08:00
parent f15b974a48
commit 1217c73c17
4 changed files with 51 additions and 63 deletions
+8 -16
View File
@@ -1,22 +1,14 @@
import pytest
from pathlib import Path
from rolltable.types import RollTable
from rolltable import tables
sources = Path(__file__).parent / '..' / 'rolltable' / 'sources'
flat_list = (sources / 'trinkets.yaml').read_text()
dict_of_dicts = (sources / 'wild_magic.yaml').read_text()
dict_of_lists = (sources / 'psychadelic_effects.yaml').read_text()
@pytest.mark.parametrize('data, expected', [
([dict_of_dicts], ['d1000 ', 'A third eye', 'Advantage on perception checks']),
([flat_list], ['d1000 ', 'ivory mimic']),
([dict_of_lists], ['d1000', 'Cosmic', 'mind expands', 'it will become so']),
@pytest.mark.parametrize('table, expected', [
(tables.wild_magic, ['d1000 ', 'A third eye', 'Advantage on perception checks']),
(tables.trinkets, ['d1000 ', 'ivory mimic']),
(tables.psychadelic_effects, ['d1000', 'Cosmic', 'mind expands', 'it will become so']),
])
def test_flat(data, expected):
rt = RollTable(data, die=1000)
def test_flat(table, expected):
table.die = 1000
for txt in expected:
assert txt in str(rt)
assert txt in str(table)