Skip to content

Commit 6c5ef77

Browse files
committed
test: test two add_file_tracer possibilities
1 parent e54b757 commit 6c5ef77

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/test_data.py

+22
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,31 @@ def test_file_tracer_name(self):
296296
})
297297
covdata.add_file_tracers({"p1.foo": "p1.plugin", "p2.html": "p2.plugin"})
298298
assert covdata.file_tracer("p1.foo") == "p1.plugin"
299+
assert covdata.file_tracer("p2.html") == "p2.plugin"
299300
assert covdata.file_tracer("main.py") == ""
300301
assert covdata.file_tracer("p3.not_here") is None
301302

303+
def test_ok_to_repeat_file_tracer(self):
304+
covdata = DebugCoverageData()
305+
covdata.add_lines({
306+
"p1.foo": dict.fromkeys([1, 2, 3]),
307+
"p2.html": dict.fromkeys([10, 11, 12]),
308+
})
309+
covdata.add_file_tracers({"p1.foo": "p1.plugin", "p2.html": "p2.plugin"})
310+
covdata.add_file_tracers({"p1.foo": "p1.plugin"})
311+
assert covdata.file_tracer("p1.foo") == "p1.plugin"
312+
313+
def test_ok_to_set_empty_file_tracer(self):
314+
covdata = DebugCoverageData()
315+
covdata.add_lines({
316+
"p1.foo": dict.fromkeys([1, 2, 3]),
317+
"p2.html": dict.fromkeys([10, 11, 12]),
318+
"main.py": dict.fromkeys([20]),
319+
})
320+
covdata.add_file_tracers({"p1.foo": "p1.plugin", "main.py": ""})
321+
assert covdata.file_tracer("p1.foo") == "p1.plugin"
322+
assert covdata.file_tracer("main.py") == ""
323+
302324
def test_cant_file_tracer_unmeasured_files(self):
303325
covdata = DebugCoverageData()
304326
msg = "Can't add file tracer data for unmeasured file 'p1.foo'"

0 commit comments

Comments
 (0)