Skip to content
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

Add test for infinite time parents #101

Merged
merged 1 commit into from
Mar 7, 2024
Merged

Add test for infinite time parents #101

merged 1 commit into from
Mar 7, 2024

Conversation

hyanwong
Copy link
Owner

@hyanwong hyanwong commented Mar 7, 2024

Fixes #95

Summary by CodeRabbit

  • Tests
    • Added a new test to verify edge addition and node time validation for infinite node times in parent-child relationships.

Copy link
Contributor

coderabbitai bot commented Mar 7, 2024

Walkthrough

This update introduces a new test to scrutinize the behavior of graphs with nodes set at infinite times, specifically focusing on parent-child edge additions and the validation of node times. This change is pivotal in addressing the considerations around allowing nodes at infinity within Graphical Isolation with Migration (GIG) models, thus ensuring compatibility with existing paradigms and enhancing the model's robustness in handling edge cases.

Changes

File Change Summary
tests/test_tables.py Added test_parent_child_at_inf to check infinite node times and validate parent-child edge addition.

Assessment against linked issues

Objective Addressed Explanation
Should GIGs be allowed to have a node at time=infinity? (#95) The change introduces a test for handling infinite times but does not explicitly decide on allowing or disallowing nodes at infinity in GIGs.

Poem

In the realm of code, where logic reigns,
A rabbit hopped, through data plains.
🐇💻 It found a node, at infinity's door,
"To allow, or not?" it pondered more.
With tests it leaped, through time and space,
Ensuring each edge, found its rightful place.
🌌🔍 In graphs so vast, with nodes spread wide,
It seeks the paths, where truths abide.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d726e99 and e2ea26e.
Files selected for processing (1)
  • tests/test_tables.py (1 hunks)
Additional comments: 1
tests/test_tables.py (1)
  • 256-265: The test method test_parent_child_at_inf correctly addresses the objectives outlined in the PR description by testing the behavior of adding edges with infinite node times. However, there are a few points to consider for improvement:
  1. Exception Message Validation: The use of match="not less than parent time" in the pytest.raises call is good practice as it ensures that the specific error message is being tested. This helps in verifying that the error raised is indeed the one expected due to the violation of node time constraints.

  2. Test Coverage: The test covers the scenario where an edge is added with a child node time not less than the parent node time, which is expected to raise a ValueError. It also tests adding an edge with valid node times, which should not raise an error. This effectively tests both the negative and positive cases for the addition of edges with infinite times.

  3. Clarity and Maintainability: The test is clear and concise, making it easy to understand what is being tested. This is crucial for maintainability and future modifications.

  4. Potential Expansion: While the current test effectively addresses the specific case of adding edges with infinite node times, consider if there are other edge cases or scenarios related to infinite node times that could be beneficial to test. For example, testing the behavior when converting the GIG to a tree sequence with infinite-time nodes present, if applicable based on the library's capabilities and the discussion in issue Should GIGs be allowed to have a node at time=infinity? #95.

Overall, the test method is well-implemented and aligns with the objectives of addressing the handling of nodes at time=infinity within GIGs. It would be beneficial to ensure comprehensive test coverage by considering additional scenarios related to infinite node times, if any.

@hyanwong hyanwong merged commit a20aa6a into main Mar 7, 2024
2 checks passed
@hyanwong hyanwong deleted the inf-parent-time-test branch March 22, 2024 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should GIGs be allowed to have a node at time=infinity?
1 participant