Extracted function to parse daily counts from a contributions SVG and added a test for it.

This commit is contained in:
Jochen Kupperschmidt
2016-06-10 00:24:06 +02:00
parent 2c9c4cba83
commit d23a2d0746
2 changed files with 22 additions and 6 deletions

View File

@ -1,4 +1,4 @@
from gitfiti import find_max_daily_commits
from gitfiti import find_max_daily_commits, parse_contributions_calendar
CONTRIBUTIONS_CALENDAR_SVG = '''\
@ -71,5 +71,19 @@ CONTRIBUTIONS_CALENDAR_SVG = '''\
'''
def test_parse_contributions_calendar():
expected = [
0, 0, 0, 0, 6, 0, 0,
0, 0, 0, 0, 0, 0, 6,
84, 16, 4, 8, 0, 0, 0,
0, 25, 66, 20, 10, 0, 0,
33, 9, 0, 0, 7,
]
actual = parse_contributions_calendar(CONTRIBUTIONS_CALENDAR_SVG)
assert list(actual) == expected
def test_find_max_daily_commits():
assert find_max_daily_commits(CONTRIBUTIONS_CALENDAR_SVG) == 84