ensure datasources are always DataSource objects
This commit is contained in:
parent
bd5e35dfff
commit
15904a51d2
|
@ -267,11 +267,11 @@ class RollTable:
|
|||
self._data = []
|
||||
for src in self._sources:
|
||||
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()
|
||||
self._data.append(ds)
|
||||
else:
|
||||
self._data.append(src)
|
||||
|
||||
# merge the headers
|
||||
self._headers = []
|
||||
|
|
|
@ -205,5 +205,6 @@ def test_text():
|
|||
|
||||
|
||||
def test_as_dict():
|
||||
ds = tables.RollTable([fixture_metadata + fixture_source]).datasources[0].as_dict()
|
||||
assert ds['Option 1']['Header 1'] == 'Option 1'
|
||||
source = tables.RollTable([fixture_no_descriptions]).datasources[0]
|
||||
ds = source.as_dict()
|
||||
assert ds['option 1']['choice'] == 'choice 1'
|
||||
|
|
Loading…
Reference in New Issue
Block a user