-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
85 additions
and
20 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,36 @@ | ||
from polyforce import PolyModel | ||
|
||
|
||
class User(PolyModel): | ||
... | ||
|
||
|
||
class Profile(User): | ||
def __init__(self) -> None: | ||
super().__init__() | ||
|
||
def get_name(self, name: str) -> str: | ||
return name | ||
|
||
|
||
def test_can_inherit(): | ||
profile = Profile() | ||
name = profile.get_name("poly") | ||
|
||
assert name == "poly" | ||
|
||
|
||
def test_ignores_checks(): | ||
class NewUser(PolyModel): | ||
config = {"ignore": True} | ||
|
||
class NewProfile(NewUser): | ||
def __init__(self): | ||
super().__init__() | ||
|
||
def get_name(self, name): | ||
return name | ||
|
||
profile = NewProfile() | ||
name = profile.get_name(1) | ||
assert name == 1 |