-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Cog 533 pydantic unit tests #230
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
628f192
Remove added_nodes and added_edges default dicts
0xideas 0ea011c
Adapt graph interfaces tests to debugged get_graph_from_model
0xideas 7be613e
WIP nested pydantic structures
0xideas 2c0fce3
WIP get_graph_from_model
0xideas 05ea357
Refactor get_graph_from_model
0xideas a586070
Remove include_root parameter
0xideas 3c8a52f
Fix inconsistent state between nodes and added_nodes and edges and ad…
0xideas afae70f
Add get_graph_from_model_generative_test
0xideas 5a464bf
Refactor get_model_instance_from_graph
0xideas 370b59b
Add get_graph_from_model_generative_test
0xideas f3f0bca
Revert making Person attributes optional
0xideas a1f7272
Revert model_rebuild order
0xideas 148eb4e
Add profile_graph_pydantic_conversion.py
0xideas 5b420eb
Autoformat graph pydantic conversion code
0xideas a334291
Apply cosmetic changes and autoformat
0xideas 8a2cf20
Add model_rebuild
0xideas 103eb13
Skip recursive pydantic tests for Python 3.9 and 3.10
0xideas fde56f0
Merge branch 'main' into COG-533-pydantic-unit-tests
0xideas b18f748
Merge dicts directly
0xideas ab1328d
Merge branch 'main' into COG-533-pydantic-unit-tests
borisarzentar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add get_graph_from_model_generative_test
- Loading branch information
commit 370b59b39a70086b7a341e63340a8cc1cb23610e
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
cognee/tests/unit/interfaces/graph/get_model_instance_from_graph_generative_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import pytest | ||
|
|
||
| from cognee.modules.graph.utils import ( | ||
| get_graph_from_model, | ||
| get_model_instance_from_graph, | ||
| ) | ||
| from cognee.tests.unit.interfaces.graph.util import ( | ||
| PERSON_NAMES, | ||
| create_organization_recursive, | ||
| show_first_difference, | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("recursive_depth", [1, 2, 3]) | ||
| def test_society_nodes_and_edges(recursive_depth): | ||
| society = create_organization_recursive( | ||
| "society", "Society", PERSON_NAMES, recursive_depth | ||
| ) | ||
| nodes, edges = get_graph_from_model(society) | ||
| parsed_society = get_model_instance_from_graph(nodes, edges, "society") | ||
|
|
||
| assert str(society) == (str(parsed_society)), show_first_difference( | ||
| str(society), str(parsed_society), "society", "parsed_society" | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.