MCPcopy
hub / github.com/treeverse/dvc / test_dict_like_interfaces

Function test_dict_like_interfaces

tests/unit/test_tabular_data.py:99–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97
98
99def test_dict_like_interfaces():
100 td = TabularData(["col-1", "col-2"])
101
102 td.extend([["foo", "bar"], ["foobar", "foobar"]])
103 assert td.keys() == ["col-1", "col-2"]
104 assert dict(td.items()) == {
105 "col-1": ["foo", "foobar"],
106 "col-2": ["bar", "foobar"],
107 }
108 assert td.as_dict() == [
109 {"col-1": "foo", "col-2": "bar"},
110 {"col-1": "foobar", "col-2": "foobar"},
111 ]
112 assert td.as_dict(["col-1"]) == [{"col-1": "foo"}, {"col-1": "foobar"}]
113
114
115def test_fill_value():

Callers

nothing calls this directly

Calls 6

extendMethod · 0.95
keysMethod · 0.95
itemsMethod · 0.95
as_dictMethod · 0.95
TabularDataClass · 0.90
dictClass · 0.85

Tested by

no test coverage detected