Skip to content

Commit

Permalink
Fixing generate markdown report and test for this function to correct…
Browse files Browse the repository at this point in the history
… the other reports bug
  • Loading branch information
Gchism94 committed Feb 29, 2024
1 parent 5b51059 commit 1b6a95d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions jupyterquest/generate_markdown_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def generate_markdown_report(quality_reports, repo_structure_results, notebook_s

# Add other reports if any
if other_reports:
report_md += "## Other Checks\n"
# Format other reports (this is a placeholder and should be expanded based on your needs)
for title, content in other_reports.items():
report_md += f"## {title}\n{content}\n"

return report_md

Expand Down
7 changes: 4 additions & 3 deletions tests/test_code_style_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ def test_linting_with_issues(self):

def test_linting_without_issues(self):
# Prepare a list of code blocks without style issues
# The following code block is correctly formatted
# with no style issues and includes a newline character at the end
code_blocks_without_style_issues = [
"import math\nx = 2\nprint(x)" # Properly formatted code
"x = 2\nprint(x)\n" # Correctly formatted code with no import statement
]
# Check style for each block
results = check_code_style(code_blocks_without_style_issues)
Expand All @@ -28,5 +30,4 @@ def test_linting_without_issues(self):
self.assertEqual(results[0].strip(), "", "Expected no style issues, but some were found in the first code block")

if __name__ == '__main__':
unittest.main()

unittest.main()
11 changes: 10 additions & 1 deletion tests/test_generate_markdown_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ def test_report_generation(self):
}

# Generate the report with the mock data
report = generate_markdown_report(sample_quality_reports, sample_repo_structure_results, notebook_stats)
other_reports = {
"Code Style Results": "No issues found.",
"Commit Analysis Results": "No commit message issues."
}
report = generate_markdown_report(
sample_quality_reports,
sample_repo_structure_results,
notebook_stats,
other_reports
)

# Test for presence of key sections and content in the report
self.assertIn("## Code Quality Checks", report)
Expand Down

0 comments on commit 1b6a95d

Please sign in to comment.