-
-
Notifications
You must be signed in to change notification settings - Fork 565
feat(interface): input type cannot inherit an interface type #1254
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
base: main
Are you sure you want to change the base?
Conversation
dd620d7
to
2d4791b
Compare
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## main #1254 +/- ##
=======================================
Coverage 97.69% 97.70%
=======================================
Files 88 88
Lines 3388 3396 +8
Branches 498 500 +2
=======================================
+ Hits 3310 3318 +8
Misses 43 43
Partials 35 35 |
Hi, thanks for contributing to Strawberry 🍓! We noticed that this PR is missing a So as soon as this PR is merged, a release will be made 🚀. Here's an example of Release type: patch
Description of the changes, ideally with some examples, if adding a new feature. Release type can be one of patch, minor or major. We use semver, so make sure to pick the appropriate type. If in doubt feel free to ask :) Here's the tweet text:
|
@@ -161,3 +162,27 @@ def anime(self) -> Anime: | |||
|
|||
assert not result.errors | |||
assert result.data == {"anime": {"name": "One Piece"}} | |||
|
|||
|
|||
def test_input_cannot_inherit_from_interface(): |
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.
Can these tests cover the actual messages of the errors as well?
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.
Do yo know how to catch the exception message with pytest? Or I need to try, catch, save, raise, assert?
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.
You can use
with pytest.raises(ExceptionType) as exc:
...
assert exc.value == "something"
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.
Also, note that pytest.raises
takes a match
argument that may be enough here
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.
Let me have a look, thanks
|
||
|
||
class InvalidSuperclassInterface(Exception): | ||
def __init__(self, input_name: str, interface_names=List[str]): |
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.
Actually, now that I think about it, wouldn't it be better to take a type
and List[type]
instead? Let the Exception handle everything related to output?
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.
You are right
Hi @scratchmex would you be able to rebase this PR and address the comments made by Bryce? 😊 no worries if not I can't take a look at some point in future :) |
Description
raises the exception
InvalidSuperclassInterface
:also works when inheriting from multiple interfaces:
Types of Changes
Issues Fixed or Closed by This PR
Checklist