MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_update

Method test_update

lib/matplotlib/tests/test_category.py:27–41  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

25 assert list(unit._mapping.values()) == locs
26
27 def test_update(self):
28 data = ['a', 'd']
29 locs = [0, 1]
30
31 data_update = ['b', 'd', 'e']
32 unique_data = ['a', 'd', 'b', 'e']
33 updated_locs = [0, 1, 2, 3]
34
35 unit = cat.UnitData(data)
36 assert list(unit._mapping.keys()) == data
37 assert list(unit._mapping.values()) == locs
38
39 unit.update(data_update)
40 assert list(unit._mapping.keys()) == unique_data
41 assert list(unit._mapping.values()) == updated_locs
42
43 failing_test_cases = [("number", 3.14), ("nan", np.nan),
44 ("list", [3.14, 12]), ("mixed type", ["A", 2])]

Callers

nothing calls this directly

Calls 2

updateMethod · 0.95
valuesMethod · 0.80

Tested by

no test coverage detected