sapp icon indicating copy to clipboard operation
sapp copied to clipboard

Added tests for filters.py in sapp/ui

Open esiebomaj opened this issue 3 years ago • 4 comments

Pre-submission checklist

  • [x] I've ran the following linters locally and fixed lint errors related to the files I modified in this PR
    • [x] black .
    • [x] usort format .
    • [x] flake8
  • [x] I've installed dev dependencies pip install -r requirements-dev.txt and completed the following:
    • [x] I've ran tests with ./scripts/run-tests.sh and made sure all tests are passing

Summary

The PR adds tests for sapp/frontend/ui/filters.py and increases the coverage for that file from 0% to 80%

Test Plan

to run the tests in test_run.py python -m coverage run -m unittest sapp.ui.tests.filter_test && python -m coverage report --show-missing --skip-covered --skip-empty

Name                        Stmts   Miss  Cover   Missing
---------------------------------------------------------
sapp/ui/filters.py          137    47    80%   

Relevant Issue : mlh-fellowship/sapp #11

esiebomaj avatar Nov 19 '21 16:11 esiebomaj

@grievejia has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot avatar Nov 19 '21 21:11 facebook-github-bot

while trying to fix some typing issues in the tests I noticed that the delete_filters function in sapp\ui\filters.py takes an argument filter_names of type Tuple[str]. This implies that it should receive a tuple with only one string in it.

But the name delete_filters implies that it should be able to accept more than one filter name. The logic in the function is also for deleting more than 1 filters Moreover, there is already a delete_filter function that deletes just one filter

So in this commit (01c3f4d) I changed the type annotation for filter_names argument from Tuple[str] with Tuple[str, ...] to reflect that the argument takes multiple filter_names

esiebomaj avatar Nov 20 '21 10:11 esiebomaj

@0xedward has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot avatar Dec 02 '21 03:12 facebook-github-bot

@0xedward has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

facebook-github-bot avatar Dec 09 '21 21:12 facebook-github-bot