Skip to content

Conversation

@rabah-khalek
Copy link
Contributor

additional test for push

@rabah-khalek rabah-khalek added Python Pull requests that update Python code push-feature labels Sep 8, 2023
@rabah-khalek rabah-khalek self-assigned this Sep 8, 2023
@linear
Copy link

linear bot commented Sep 8, 2023

def test_test_function_and_output(enron_model, enron_data):

# Define a list of push types and corresponding functions
push_types = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're modifying this test anyway, let's take a chance to improve it:
instead of storing push_types list you can turn it into a parameterized test. This will:

  • improve parallelization as each test will be able to executed separately
  • debuggability: it'll be possible to execute a test for a given set of inputs and know which combination lead to an error

outputs = {push_type: [] for push_type, _ in push_types}

# Loop through the range and create push outputs
for i in range(50):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of blindly taking 50 first rows of enron. In this case we're not really sure what we're testing on. If we know which input leads to which push generation we should use it explicitly.
For example you can take row #5 that is known to generate 2 pushes and assert that both of them are generated and contain expected results.

# Check if push output has the correct type
# Check if the tests created by push are instance of GiskardTest
for push_type, push_outputs in outputs.items():
if push_outputs:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related to the comment above, if we know that a specific row should result in a specific set of pushes we shouldn't use if push_outputs, but rather assert len(push_outputs)>0

Copy link
Contributor Author

@rabah-khalek rabah-khalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with your implementations @Hartorn! it's mergeable to me.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@Hartorn Hartorn merged commit 22c6678 into main Sep 29, 2023
@Hartorn Hartorn deleted the GSK-1710 branch September 29, 2023 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

push-feature Python Pull requests that update Python code

Development

Successfully merging this pull request may close these issues.

4 participants