示例#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
示例#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')"
示例#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
示例#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")
示例#5
0
def test_types_rows_specs_len():
    d = types.Rows()
    d.add_row((b"1", b"2"))
    assert len(d) == 1
示例#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"
示例#7
0
def test_types_rows_specs_property():
    d = types.Rows(col_specs=[{"name": "one"}, {"name": "two"}])
    assert len(d.col_specs) == 2
示例#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")]