fix: resolve pre-existing test failures and improve coverage (#833)#834
fix: resolve pre-existing test failures and improve coverage (#833)#834Aryanbansal-05 wants to merge 5 commits into
Conversation
…rshita#833) - Add JSON array support to parse_skills() - Add coverage ratio weighting to score_single_project() - Fix VALID_INTERESTS undefined NameError in validate_recommendation_inputs() - Fix get_recommendations() to return plain list - Add VALID_LEVELS and VALID_TIME_AVAILABILITY to test imports - Fix duplicate project IDs (10, 11, 13) in projects.json
|
@Aryanbansal-05 is attempting to deploy a commit to the komalsony234-1530's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
The remaining 9 test failures (test_error_handling.py, test_bookmarks.py, test_no_results_reset.py, test_resource_url_validation.py) are pre-existing failures unrelated to utils/recommender.py or this PR's scope (#833). They exist independently on main due to Flask version incompatibilities and other issues in those test files. |
|
The "CI / Test" workflows run pytest tests/ (the entire test directory), so they also execute the 9 pre-existing failures in test_error_handling.py, test_bookmarks.py, etc. (unrelated to #833/recommender.py). These failures exist on main independently of this PR — tests/test_basic.py itself is fully passing (pytest tests/test_basic.py → 0 failed). |
Summary [required]
This PR resolves pre-existing test failures that were blocking the test suite from running cleanly. The fixes address a NameError for VALID_INTERESTS in the recommender, incorrect return type from get_recommendations(), missing coverage ratio weighting in score_single_project(), lack of JSON array support in parse_skills(), missing imports in the test file, and duplicate project IDs in projects.json. No new features are introduced — this is purely a correctness and test coverage fix in line with issue #833.
Closes #833
Type of Change [required]
What Was Changed [required]
| File | Change made |
File | Change made
utils/recommender.py | Added JSON array parsing to parse_skills(); added coverage ratio weighting to score_single_project(); fixed VALID_INTERESTS undefined error; changed get_recommendations() to return a plain list
routes/main_routes.py | No logic change; confirmed compatible with updated get_recommendations() return type
tests/test_basic.py | Added VALID_LEVELS and VALID_TIME_AVAILABILITY to recommender imports; added SCORING_WEIGHTS alias for removed individual weight constants
data/projects.json | Fixed duplicate IDs: API ETL Pipeline → 20, Number Guessing Game → 21, Quiz App → 22
How to Test This PR [required]
git checkout your-branch-namepip install -r requirements.txtpython app.pypython tests/test_basic.pyExpected test output:
72 passed in 0.05s
Test Results [required]
72 passed in 0.05s
Screenshots (if UI change)
Self-Review Checklist [required]
feat/,fix/,docs/,data/,style/,test/python tests/test_basic.pyand all 27 tests passflake8 .locally and there are no errorsprint()orconsole.log()debug statementsNotes for Reviewer
The original test suite had 16 failing tests due to bugs in utils/recommender.py and data/projects.json that pre-dated this branch. All fixes made are minimal and targeted — no scoring logic was changed beyond what the existing tests themselves specify as correct behaviour. The flake8 check should be run before final merge as some lines in recommender.py may exceed the line length limit.