File: test_table.py

package info (click to toggle)
python-ase 3.24.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 15,448 kB
  • sloc: python: 144,945; xml: 2,728; makefile: 113; javascript: 47
file content (28 lines) | stat: -rw-r--r-- 730 bytes parent folder | download
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']