-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactored test_tracer_analysis_service module with additional testcases #2181
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2181 +/- ##
==========================================
+ Coverage 75.48% 75.62% +0.14%
==========================================
Files 78 78
Lines 2921 2938 +17
Branches 309 309
==========================================
+ Hits 2205 2222 +17
Misses 651 651
Partials 65 65 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @SakshiKekre, this is a really great foray into testing! Thanks for the work you've done here. I had a couple comments inline, but a couple more for you:
- I'd move this file to
tests/unit/services/test_tracer_analysis_service.py
, since this will become the new test for that service. We'll knit this and Zeel's, I think it is, together down the road - I'd add the following test cases:
- A variable name that isn't a string (we should make sure this raises an error)
- A case where two variables have the same name for some reason (I think it should return the first one in the data, if I remember correctly - let me know if you run into problems here)
- A case where one variable is a subset of another variable, but the longer one occurs first (e.g., "this_is_a_variable" and "this_is_a_variable_with_a_longer_name") - obviously we'll want to be sure we're returning the correct one
- A case where the result is not of type list[str] - we'll want to raise an error
Thanks again! Looking forward to seeing more of this down the road.
Hey @anth-volk , thanks for your inputs. These are really great test case suggestions. I'm working on incorporating them in my tests and had some thoughts/questions:
I'm assuming here that you mean the target function should raise an error. If my assumption is correct, do we want the test case to fail if the target function does not 'raise' an error?
This works as expected; target function returns the first occurrence of the variable.
This one fails. Target function incorrectly returns the output associated with the longer variable if it occurs before the actual (expected) variable in the tracer. Might have to fix the regex in the target function.
By 'result', do you mean the output from target function (parse_tracer_output) or the input tracer (which is also a mocked result as expected to be returned by get_tracer) to the target function? Please let me know your thoughts on how I should proceed with 1, 3 and 4. |
Refactored the module to run following test cases:
Possible future cases in consideration: