Skip to content

Commit

Permalink
TST: use explicit ClassWithNew instead of typing.Generic
Browse files Browse the repository at this point in the history
typing.Generic doesn't have a __new__ method in 3.9.

Fixes #355
  • Loading branch information
catern authored and kernc committed Sep 24, 2021
1 parent f358893 commit 4aa70de
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pdoc/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,16 +1043,20 @@ class C2:

self.assertEqual(pdoc.Class('C2', mod, C2).params(), ['a', 'b', 'c=None', '*', 'd=1', 'e'])

class G(typing.Generic[T]):
class ClassWithNew:
def __new__(self, arg):
pass

class G(ClassWithNew):
def __init__(self, a, b, c=100):
pass

self.assertEqual(pdoc.Class('G', mod, G).params(), ['a', 'b', 'c=100'])

class G2(typing.Generic[T]):
class G2(ClassWithNew):
pass

self.assertEqual(pdoc.Class('G2', mod, G2).params(), ['*args', '**kwds'])
self.assertEqual(pdoc.Class('G2', mod, G2).params(), ['arg'])

def test_url(self):
mod = pdoc.Module(EXAMPLE_MODULE)
Expand Down

0 comments on commit 4aa70de

Please sign in to comment.