Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
Expand Down
11 changes: 6 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,17 @@ def generate_content(readme_instance: ReadmeLevel, start_section: str, end_secti
user_level, to_next_lvl = itemgetter("current_level",
"percentage_level")(readme_instance.get_current_level)

CONTRIBUTION_EP = readme_instance.get_contribution_ep
FOLLOWER_EP = readme_instance.get_follower_ep
contribution_ep = readme_instance.get_contribution_ep
follower_ep = readme_instance.get_follower_ep

# should be generated in later versions
ep_information = (f"<pre>💪 1x contribute → { CONTRIBUTION_EP } experience points\n"
f"🌟 1x follower → { FOLLOWER_EP } experience points</pre>\n")
ep_information = (f"<pre>💪 1x contribute → { contribution_ep } experience points\n"
f"🌟 1x follower → { follower_ep } experience points</pre>\n")

return (f"{start_section}\n"
f"{ getenv('INPUT_CARD_TITLE') if getenv('INPUT_CARD_TITLE') else '' } \n"
f"<pre>level: { user_level } { draw_progress_bar(to_next_lvl) } {round(to_next_lvl, 2)}%</pre>\n"
f"<pre>level: { user_level } \
{ draw_progress_bar(to_next_lvl) } {round(to_next_lvl, 2)}%</pre>\n"
f"{ ep_information if getenv('INPUT_SHOW_EP_INFO') else '' }"
f"{end_section}")

Expand Down
9 changes: 5 additions & 4 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,17 @@ def test_generate_content(self) -> None:
mock_readme_instance.get_current_level.return_value = {
"current_level": "10", "percentage_level": 20}

START_SECTION: str = "<!--README_LEVEL_UP:START-->"
END_SECTION: str = "<!--README_LEVEL_UP:END-->"
start_section: str = "<!--README_LEVEL_UP:START-->"
end_section: str = "<!--README_LEVEL_UP:END-->"

with patch('main.draw_progress_bar') as mock_draw_progress_bar:
mock_draw_progress_bar.return_value = "██████░░░░░░░░░░░░░░░░░░░░░░░░"

replace_str: str = generate_content(
mock_readme_instance, START_SECTION, END_SECTION)
mock_readme_instance, start_section, end_section)

# we check only if return value is from type str because the spaces makes it realy difficult to check for isEqual
# we check only if return value is from type str because the spaces makes
# it realy difficult to check for isEqual
self.assertIsInstance(replace_str, str)


Expand Down