-
Notifications
You must be signed in to change notification settings - Fork 7
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
LIU-388: Update test_pg_gen.py to compare results to test data. #260
Conversation
Reviewer's Guide by SourceryThis pull request addresses the lack of assert-based integration tests in the File-Level Changes
|
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 @myxie - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 9 issues found
- 🟢 Complexity: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
) | ||
|
||
|
||
class TestLGUnroll(unittest.TestCase): |
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.
suggestion (testing): Add edge case for empty graph
Consider adding a test case for an empty graph to ensure that the unroll_to_tpl
method handles it gracefully.
class TestLGUnroll(unittest.TestCase): | |
class TestLGUnroll(unittest.TestCase): | |
def test_empty_graph(self): | |
lg = LG() # Assuming LG is the class being tested | |
result = lg.unroll_to_tpl() | |
self.assertEqual(result, expected_output) # Replace expected_output with the actual expected result |
for lgn, num_keys in lg_names.items(): | ||
fp = get_lg_fname("logical_graphs", lgn) | ||
lg = LG(fp, ssid=TEST_SSID) | ||
self.assertEqual(len(lg._done_dict.keys()), num_keys) |
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.
suggestion (testing): Add assertion message for better debugging
Consider adding a custom message to the assertion for better debugging, e.g., self.assertEqual(len(lg._done_dict.keys()), num_keys, f"Failed for {lgn}")
.
self.assertEqual(len(lg._done_dict.keys()), num_keys) | |
self.assertEqual(len(lg._done_dict.keys()), num_keys, f"Failed for {lgn}") |
Improve error reporting for failures.
Hi @awicenec, would you mind reviewing these additions to the PG tests? |
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.
Thanks for going through all of this. Looks good to me and will certainly aid us performing more severe surgeries in the code in the near future.
LIU-388: Update test_pg_gen.py to compare results to test data.
Issue
There exists a number of
daliuge-translator
that do notassert
anything in the test cases; their only currently use-case is to ensure that we don't cause run-time errors when updating the code, rather than checking for specific regressions.This leaves me quite worried about the potential of introducing regressions when updating the code in
lg.py/pgt(p).py
, as we are not doing regression testing with our tests.Solution
This PR introduces some assert-based integration tests to confirm that we are not regressing, or to notify us to to update the existing test graphs in the event of a schema change.
Summary by Sourcery
This pull request enhances the test_pg_gen.py file by adding assert-based integration tests to ensure regression testing for logical graph unrolling and physical graph template generation. It introduces new test data files in JSON and pickle formats and includes comprehensive tests for various partitioning methods and their results.