Update tests for stats chart without heading
This commit is contained in:
1 parent
86c00ae3f9
commit
bce8084306
2 files changed
+6
-17
No files matched your search
+5
-14
@@ -174,33 +174,24 @@ def test_network_error_on_an_excluded_file_is_ignored(gitea, monkeypatch):
|
||||
|
||||
def test_markdown_lists_languages_largest_first_with_bars_and_percentages():
|
||||
# Python 75% -> 75/2 = 37 bar blocks; JavaScript 25% -> 25/2 = 12 blocks.
|
||||
# Lines are joined with a backslash (a markdown line break); the heading is
|
||||
# followed by a single newline and the last line has no trailing break
|
||||
# (regression tests for 95aaf91 and 57a5188).
|
||||
# Lines are joined with a backslash (a markdown line break) and the last
|
||||
# line has no trailing break (regression test for 57a5188).
|
||||
assert generate_markdown({"JavaScript": 250, "Python": 750}) == (
|
||||
"## 📊 Languages\n"
|
||||
+ "█" * 37
|
||||
+ " Python 75.0%\\\n"
|
||||
+ "█" * 12
|
||||
+ " JavaScript 25.0%"
|
||||
"█" * 37 + " Python 75.0%\\\n" + "█" * 12 + " JavaScript 25.0%"
|
||||
)
|
||||
|
||||
|
||||
def test_markdown_percentages_are_rounded_to_one_decimal():
|
||||
# Python 2/3 = 66.67% -> 66.7, 33 blocks; Lua 1/3 = 33.33% -> 33.3, 16 blocks.
|
||||
assert generate_markdown({"Python": 2, "Lua": 1}) == (
|
||||
"## 📊 Languages\n" + "█" * 33 + " Python 66.7%\\\n" + "█" * 16 + " Lua 33.3%"
|
||||
"█" * 33 + " Python 66.7%\\\n" + "█" * 16 + " Lua 33.3%"
|
||||
)
|
||||
|
||||
|
||||
def test_markdown_leaves_out_languages_with_zero_bytes():
|
||||
# e.g. every HTML byte came from excluded files
|
||||
assert generate_markdown({"Python": 750, "JavaScript": 250, "HTML": 0}) == (
|
||||
"## 📊 Languages\n"
|
||||
+ "█" * 37
|
||||
+ " Python 75.0%\\\n"
|
||||
+ "█" * 12
|
||||
+ " JavaScript 25.0%"
|
||||
"█" * 37 + " Python 75.0%\\\n" + "█" * 12 + " JavaScript 25.0%"
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user