-
Notifications
You must be signed in to change notification settings - Fork 38
🚸 Broaden name deduplication in HasType to search all contexts if no type is passed
#3850
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
Open
ishitajain9717
wants to merge
12
commits into
main
Choose a base branch
from
fixing_creating_projects
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2c0725c
broaden type-scoped dedup to search all contexts when type= is not pa…
ishitajain9717 784951d
add fallback to search typed records when root-level dedup finds nothing
ishitajain9717 e8745e5
making changes so test does not break retaining originl behaviour and…
ishitajain9717 1b60822
solving duplication
ishitajain9717 4f7a15c
minor changes in schema
ishitajain9717 c92a784
minor changes in tests
ishitajain9717 bc43b13
using unset here
ishitajain9717 b917409
removing type_val
ishitajain9717 03d36ca
minor change
ishitajain9717 6a01541
minor changed in tests and the syntax
ishitajain9717 9033d3a
minor changes in conditioning
ishitajain9717 b5a25b8
changing overload
ishitajain9717 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
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
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
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
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
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
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
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
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 |
|---|---|---|
|
|
@@ -690,14 +690,24 @@ def test_feature_manager_raise_not_validated_values(): | |
| def test_name_lookup(): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't we now missing a test here where the user explicitly passes |
||
| my_type = ln.Record(name="MyType", is_type=True).save() | ||
| label1 = ln.Record(name="label 1", type=my_type).save() | ||
| # same type → returns existing typed record | ||
|
ishitajain9717 marked this conversation as resolved.
|
||
| label2 = ln.Record(name="label 1", type=my_type) | ||
| assert label2 == label1 | ||
| # no type passed, only typed record exists → fallback returns the typed one | ||
|
ishitajain9717 marked this conversation as resolved.
|
||
| label2 = ln.Record(name="label 1") | ||
| assert label2 != label1 | ||
| label2.save() | ||
| label3 = ln.Record(name="label 1") | ||
| assert label3 == label2 | ||
| label2.delete(permanent=True) | ||
| assert label2 == label1 | ||
| # explicit type=None → root-level dedup: label1 is typed so not found → new record | ||
| label_new = ln.Record(name="label 1", type=None) | ||
| assert label_new != label1 | ||
| assert label_new._state.adding # not yet saved, truly a new record | ||
| # explicit type=None, root-level record exists → root-level dedup finds it → returns it | ||
| root_label = ln.Record(name="root label 1").save() | ||
| label3 = ln.Record(name="root label 1", type=None) | ||
| assert label3 == root_label | ||
| # no type passed (UNSET) → search all → finds the existing root-level record | ||
| label4 = ln.Record(name="root label 1") | ||
| assert label4 == root_label | ||
| root_label.delete(permanent=True) | ||
| label1.delete(permanent=True) | ||
| my_type.delete(permanent=True) | ||
|
|
||
|
|
@@ -1194,7 +1204,7 @@ def test_record_features_add_remove_values(): | |
|
|
||
| # test passing ISO-format date string for date | ||
|
|
||
| test_record2 = ln.Record(name="test_record").save() | ||
| test_record2 = ln.Record(name="test_record_2").save() | ||
| # we could also test different ways of formatting but don't yet do that | ||
| # in to_dataframe() we enforce ISO format already | ||
| feature_date = ln.Feature.get(name="feature_date") | ||
|
|
||
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
Oops, something went wrong.
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.
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.
I would have expected something like this:
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.
There is a question whether we should use
kwargs["type"]instead ofkwargs.get()because we might now actually have a contract that guarantees the presence oftypesince it would never be popped? 🤔