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

Function test_get_summary

tests/unit/utils/test_humanize.py:8–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6
7
8def test_get_summary():
9 # dict, so that we could delete from it easily
10 stats = OrderedDict(
11 [
12 ("fetched", 3),
13 ("added", ["file1", "file2", "file3"]),
14 ("deleted", ["file4", "file5"]),
15 ("modified", ["file6", "file7"]),
16 ]
17 )
18
19 assert (
20 get_summary(stats.items())
21 == "3 files fetched, 3 files added, 2 files deleted and 2 files modified"
22 )
23
24 del stats["fetched"]
25 del stats["deleted"][1]
26 assert (
27 get_summary(stats.items())
28 == "3 files added, 1 file deleted and 2 files modified"
29 )
30
31 del stats["deleted"][0]
32 assert get_summary(stats.items()) == "3 files added and 2 files modified"
33
34 del stats["modified"]
35 assert get_summary(stats.items()) == "3 files added"
36
37 assert not get_summary([])
38 assert not get_summary([("x", 0), ("y", [])])
39 assert get_summary([("x", 1), ("y", [])]) == "1 file x"
40
41
42def test_truncate_text():

Callers

nothing calls this directly

Calls 2

get_summaryFunction · 0.90
itemsMethod · 0.80

Tested by

no test coverage detected