test01_cfg.py 674 B

1234567891011121314151617181920212223
  1. from unittest import TestCase
  2. from importlib import reload
  3. from os import environ
  4. from tests import TEST_DATA_DIR
  5. import scriptshifter.tables
  6. class TestConfig(TestCase):
  7. """ Test configuration parsing. """
  8. def test_ordering(self):
  9. environ["TXL_CONFIG_TABLE_DIR"] = TEST_DATA_DIR
  10. reload(scriptshifter.tables) # Reload new config dir.
  11. from scriptshifter import tables
  12. tables.list_tables.cache_clear()
  13. tables.load_table.cache_clear()
  14. tbl = tables.load_table("ordering")
  15. exp_order = ["ABCD", "AB", "A", "BCDE", "BCD", "BEFGH", "B"]
  16. assert [s[0] for s in tbl["roman_to_script"]["map"]] == exp_order