Name: Python-Markdown
URL: https://github.com/Python-Markdown/markdown
Number of lines of code and the tool used to count it: number of lines of code (nloc): 17295.
Tested by using Lizard to count the nloc.
Programming language: Python
The coverage check is done with coverage.py. The following command is used to check the total coverage throughout the project:
$ coverage run -m unittest discover
Total function coverage was 95%:

Said Musab Oguz
Screenshot of the coverage results:
Screenshot of the coverage results:

Mihnea-Andrei Bârsan
Screenshot of the coverage results:
Screenshot of the coverage results:
Robert Sofroni
Screenshot of the coverage results:
Screenshot of the coverage results:
Alexandru-Valentin Florea
Said Musab Oguz
Link to the patch (diff) for the new test file
Old coverage result:
New coverage result:
As can be seen from the tests, the coverage increased from 0% to 100%. There were no tests that cover this function. After adding 3 tests that check the behaviour of the function and checks the branch coverage for all 3 branches, the coverage increased.
The new tests check the function in 3 cases:
- Tests that an empty string returns an empty list
- Tests that the function throws a ValueError
- Tests that valid line numbers are returned as a list of integers.
Link to the patch (diff) for the new test file
Old coverage result:

New coverage result:

As can be seen from the tests, the coverage increased from 0% to 100%. There were no tests that cover this function. After adding 9 tests that check the behaviour of the function and checks the branch coverage for all 9 branches, the coverage increased with each test a little more.
The new tests check the function in 9 cases:
- Tests hilite with specified language
- Tests hilite with language guessing
- Tests hilite without pygments (JavaScript fallback) with line numbers
- Tests hilite with invalid pygments formatter
- Tests hilite with line numbers enabled
- Tests hilite without shebang parsing
- Tests hilite with custom pygments formatter callable
- Tests hilite with double fallback for lexer
- Tests hilite without pygments but with language class and line numbers
Mihnea-Andrei Bârsan
Link to the patch (diff) for the new test file
Old coverage result:
New coverage result:
The initial tests of the forked repository covered 0% of the function HiliteTreeprocessor.run and, after finishing the tests in test_HT_run.py, the tests of the forked repository covered 100% of the function HiliteTreeprocessor.run. Considering that HiliteTreeprocessor.run takes indirectly as input an XML element tree, the tests in test_HT_run.py cover these scenarios:
- the inputted XML element tree contains at least one <pre> block, but each such <pre> block does not contain exactly one subblock or does not contain a <code> subblock;
- the inputted XML element tree contains at least one <pre> block and at least one such <pre> block contains exactly one subblock and that subblock is a <code> subblock and this <code> subblock contains some text;
- the inputted XML element tree contains at least one <pre> block and at least one such <pre> block contains exactly one subblock and that subblock is a <code> subblock, but this <code> subblock contains no text.
Link to the patch (diff) for the new test file
Old coverage result:
New coverage result:
After finishing the tests in test_html_2_text.py, the tests of the forked repository went from covering 0% of the function stashedHTML2text._html_sub to covering 100% of the function stashedHTML2text._html_sub. Considering that stashedHTML2text._html_sub takes indirectly as input raw HTML, the following scenarios are covered by the tests in test_html_2_text.py:
- indirectly inputted raw HTML without stripping of entities;
- indirectly inputted raw HTML with stripping of entities.
Robert Sofroni
Link to the patch (diff) for the new test file
Old coverage result:
New coverage result:
As can be seen from the tests, the coverage increased from 0% to 100%. There were no tests that covered this function. After adding 3 tests that check the behavior of the function and check the branch coverage for all 3 branches, the coverage increased.
The new tests check the function in 3 cases:
- Tests dequote when given a text with double quotes
- Tests dequote when given a text with single quotes
- Tests dequote when given a text that has no quotes
Link to the patch (diff) for the new test file
Old coverage result:
New coverage result:
As can be seen from the tests, the coverage increased from 0% to 100%. There were no tests that covered this function. After adding 4 tests that check the behavior of the function and check the branch coverage for all 5 branches, the coverage increased with each test a little more.
The new tests check the function in 5 cases:
- Tests _parseHeader when given a real shebang line at the beginning of the code block
- Tests _parseHeader when given a mock shebang line without a path
- Tests _parseHeader when given colons instead of a shebang line to indicate the language
- Tests _parseHeader when given a shebang-like line with highlight lines specified
- Tests _parseHeader that has no shebang or colon line at the beginning of the code block
Alexandru-Valentin Florea
Old coverage result:
New coverage result:
As the above screenshots show, the coverage increased from 0% to 100%. There were no tests that covered this initialisation function. After adding 4 tests that check the behaviour of the function and checks the branch coverage for all 3 branches, the coverage increased.
The tests added cover the following scenarios:
- Test a checks correct behavior with missing 'linenos' key in the arguments list
- Test b checks correct behavior with missing 'css' key in the arguments list
- Test c checks correct behavior with missing 'wrap' key in the arguments list
- Test d checks correct behavior with an empty arguments list to see if the fallback values are applied correctly
- Test A is just to show the original coverage, 0%
Old coverage result:
New coverage result:
As the above screenshots show, the coverage increased from 0% to 100%. There were no tests that covered this initialisation function. After adding 4 tests that check the behaviour of the function and checks the branch coverage for all 4 branches, the coverage increased.
The tests added cover the following scenarios:
- Test a checks correct behavior with empty config list, to see if the standard one is applied correctly
- Test b checks correct behavior with a key that changes a value from default config
- Test c checks correct behavior with a key that isn't part of the original config dictionary and also isn't a string so it can't be passed to the parsing function
- Test d checks correct behavior with
-
- a key that isn't part of the original config dictionary, is a string and can be parsed into a bool
-
- a key that isn't part of the original config dictionary, is a string but can't be parsed into a bool
-
- Test A is just to show the original coverage, 0%
The old coverage results by running the existing tool (coverage.py):

The new coverage results by running the existing tool using all test modifications made by the group:

With the new coverage report, coverage increases can be seen in the following files:
- init.py
- codehilite.py
- toc.py
- util.py
- Forked the upstream Python markdown repository
- Added some tests for parse_hl_lines and codehilite functions
- Initialized and added some parts for parse_hl_lines and codehilite functions to this README file
- Did the documentation of README excluding the parts of individual group members
- Added some tests for HiliteTreeprocessor.run and stashedHTML2text._html_sub functions
- Added some parts for HiliteTreeprocessor.run and stashedHTML2text._html_sub functions to this README file
- (With a bit of help from Musab) Wrapped up this assignment for submission
Alexandru-Valentin Florea
- Added some tests for CodeHilite.init and CodeHiliteExtension.init functions
- Added some parts for CodeHilite.init and CodeHiliteExtension.init functions to this README file
Robert Sofroni
- Added some tests for dequote and _parseHeader functions
- Added some parts for dequote and _parseHeader functions to this README file