8000 Adds typeclass definition validation by sobolevn · Pull Request #245 · dry-python/classes · GitHub
[go: up one dir, main page]

Skip to content

Adds typeclass definition validation #245

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 3 commits into from
Jul 3, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds more test for associated types
  • Loading branch information
sobolevn committed Jul 3, 2021
commit f688197cb3976344544021c072e2e34de88613d4
15 changes: 15 additions & 0 deletions typesafety/test_typeclass/test_validation/test_body.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@
main:3: error: Typeclass definitions must not have bodies


- case: typeclass_with_body_and_associated_type
disable_cache: false
main: |
from classes import typeclass, AssociatedType

class Some(AssociatedType):
...

@typeclass(Some)
def args(instance) -> str:
return 'a'
out: |
main:6: error: Typeclass definitions must not have bodies


- case: typeclass_with_two_ellipsises
disable_cache: false
main: |
Expand Down
15 changes: 15 additions & 0 deletions typesafety/test_typeclass/test_validation/test_first_arg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@
main:3: error: First argument in typeclass definition must be positional


- case: typeclass_first_arg_opt_with_associated
disable_cache: false
main: |
from classes import typeclass, AssociatedType

class Some(AssociatedType):
...

@typeclass(Some)
def args(instance: int = 1) -> str:
...
out: |
main:6: error: First argument in typeclass definition must be positional


- case: typeclass_first_arg_star
disable_cache: false
main: |
Expand Down
0