Name: discord.py
URL: https://github.com/Rapptz/discord.py
Number of lines of code and the tool used to count it: 68242 using lizard discord tests setup.py
Programming language: Python
The coverage tool coverage.py was used for this project.
After installing the dependencies and executing coverage run -m pytest
we get the following output:
Running coverage html
and opening the document in the browser gives the following:
commit + commit Note: the second commmit is the final instrumentation
The coverage improvement is +100%.
The coverage has been improved, because flatten_literal_params
used to not be tested, while the new test_flatten_literal_params
considers every branch to be taken.
The coverage improvement is +100%.
The coverage has been improved, because _human_join
used to not be tested, while the new test__human_join
considers every branch to be taken.
The coverage improvement is +100%.
The coverage has been improved, because escape_markdown
used to not be tested, while the new test_escape_markdown
considers every branch to be taken.
The coverage improvement is +100%.
The coverage has been improved, because string_width
used to not be tested, while the new string_width
considers every branch to be taken.
The coverage improvement is 88%. The coverage has been improved, because the previous test_get_find only considered the sync and asyn get with single values. I extended the test so that it tests these functions with multiple attributes as well, this way it currently reaches more branches and therefore the coverage improved. Additionally the previous test did not consider the case where we loop through the array and we don't find the corresponding item we are looking for, we added this case by giving an empty array as argument, which causes the code to not enter the for loop and thus reach more branches.
The coverage improvement is 71%. The coverage has been improved, because the previously there was no test for json_or_text. I now added a test that considers two cases: one where the data is a json and one where the data is plain text. This way we reach two additional branches and thus the coverage improves.
The coverage of the function has improved from the original 78% to 100%, since the other two branches (1 and 3) were also covered.
The coverage improved from 85% to 100%. Since the tests resulted in each of the if statements to trigger, each of the two missing branches were also covered.
The total coverage before adding our own tests
The total coverage after adding our own tests
- Created a custom coverage tool
cov
(#2) - Measured and increased the coverage of
flatten_literal_params
(#5) - Measured and increased the coverage of
_human_join
(#6)
- Measured and increased the coverage of
_string_width
(#17) - Measured and increased the coverage of
escape_markdown
(#17)
- Measured and increased the coverage of
_get
and_aget
(#11) - Measured and increased the coverage of
json_or_text
(#13)
- Measured and increased the coverage of
parse_rgb_number
(#8) - Measured and increased the coverage of
from_str
(#19)