1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
from types import SimpleNamespace
from ase.db.table import Table
class TestConnection:
def select(self,
query,
verbosity,
limit,
offset,
sort,
include_data,
columns):
return [SimpleNamespace(id=1, a='hello'),
SimpleNamespace(id=2, a='hi!!!', b=117)]
def test_hide_empty_columns():
db = TestConnection()
table = Table(db)
for show in [True, False]:
table.select('...', ['a', 'b', 'c'], '', 10, 0,
show_empty_columns=show)
if show:
assert table.columns == ['a', 'b', 'c']
else:
assert table.columns == ['a', 'b']
|