Exemple #1
0
    async def extend(state):
        if state == b"1":
            h = types.PagingRows(paging_state=b"2")
            h.add_row((b"1", b"2"))
            h.add_row((b"3", b"4"))
            return h

        g = types.Rows()
        g.add_row((b"5", b"6"))
        g.add_row((b"7", b"8"))
        return g
Exemple #2
0
def test_types_rows_specs_repr():
    d = types.Rows()
    d.add_row((b"1", b"2"))
    d.col_specs = [{"name": "one"}, {"name": "two"}]
    d.add_row((b"3", b"4"))
    assert f"{list(d)[0]}" == "Row(one=b'1', two=b'2')"
Exemple #3
0
def test_types_rows_reset():
    d = types.Rows()
    d.add_row((b"1", b"2"))
    d.add_row((b"3", b"4"))
    count = len(list(d)) + len(list(d))
    assert count == 4
Exemple #4
0
def test_types_rows_specs_offset():
    d = types.Rows()
    d.add_row((b"1", b"2"))
    assert d[0] == (b"1", b"2")
Exemple #5
0
def test_types_rows_specs_len():
    d = types.Rows()
    d.add_row((b"1", b"2"))
    assert len(d) == 1
Exemple #6
0
def test_types_rows_specs_a4():
    d = types.Rows()
    d.add_row((b"1", b"2"))
    d.col_specs = [{"name": "one"}, {"name": "two"}]
    d.add_row((b"3", b"4"))
    assert list(d)[0].two == b"2"
Exemple #7
0
def test_types_rows_specs_property():
    d = types.Rows(col_specs=[{"name": "one"}, {"name": "two"}])
    assert len(d.col_specs) == 2
Exemple #8
0
def test_types_rows():
    d = types.Rows()
    d.add_row((b"1", b"2"))
    d.add_row((b"3", b"4"))
    assert list(d) == [(b"1", b"2"), (b"3", b"4")]