ensure datasources are always DataSource objects

This commit is contained in:
evilchili 2023-12-22 23:09:43 -08:00
parent bd5e35dfff
commit 15904a51d2
2 changed files with 6 additions and 5 deletions

View File

@ -267,11 +267,11 @@ class RollTable:
self._data = [] self._data = []
for src in self._sources: for src in self._sources:
if type(src) is str: if type(src) is str:
ds = DataSource(src, frequency=self._frequency) src = [src]
for one_source in src:
ds = DataSource(one_source, frequency=self._frequency)
ds.load_source() ds.load_source()
self._data.append(ds) self._data.append(ds)
else:
self._data.append(src)
# merge the headers # merge the headers
self._headers = [] self._headers = []

View File

@ -205,5 +205,6 @@ def test_text():
def test_as_dict(): def test_as_dict():
ds = tables.RollTable([fixture_metadata + fixture_source]).datasources[0].as_dict() source = tables.RollTable([fixture_no_descriptions]).datasources[0]
assert ds['Option 1']['Header 1'] == 'Option 1' ds = source.as_dict()
assert ds['option 1']['choice'] == 'choice 1'