def test_types_row_specs_eq2(): data = OrderedDict() data["a"] = 1 data["b"] = 2 data["c"] = 3 d = types.Row(**data) g = types.Row(1, 2, 3, fields_=["a", "b", "c"]) assert d == g
def test_types_row_specs_getattr(): data = OrderedDict() data["a"] = 1 data["b"] = 2 data["c"] = 3 d = types.Row(**data) assert getattr(d, "foo", None) is None
def test_types_row_specs_asdict_attr(): data = OrderedDict() data["a"] = 1 data["b"] = 2 data["c"] = 3 d = types.Row(**data) assert d.b == 2
def test_types_row_specs_asdict_index(): data = OrderedDict() data["a"] = 1 data["b"] = 2 data["c"] = 3 d = types.Row(**data) assert d[2] == 3
def test_types_row_specs_dir(): d = types.Row(b"1", b"2", fields_=["a", "b"]) assert "args" not in dir(d) and "a" in dir(d)
def test_types_row_specs_len(): d = types.Row(b"1", b"2", fields_=["a", "b"]) assert len(d) == 2
def test_types_row_specs_eq2_bad(): from uuid import uuid4 d = uuid4() g = types.Row(1, 2, 3, fields_=["a", "b", "c"]) assert d != g
def test_types_row_specs_item(): d = types.Row(1, 2, 3, fields_=["a", "b", "c"]) assert d[2] == 3
def test_types_row_specs_iter(): d = types.Row(1, 2, 3, fields_=["a", "b", "c"]) cnt = 0 for _ele in d: cnt += 1 assert cnt == 3
def test_types_row_specs_dict(): d = types.Row(1, 2, 3, fields_=["a", "b", "c"]) assert dict(d.asdict_()) == {"a": 1, "b": 2, "c": 3}