Skip to content

Commit bb7c65e

Browse files
committed
Test indented generics and aliases
1 parent cda078d commit bb7c65e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test-data/unit/stubgen.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4425,13 +4425,19 @@ class C2[T2: int]: ...
44254425
class C3[T3: str | bytes]: ...
44264426
class C4[T4: (str, bytes)]: ...
44274427

4428+
class Outer:
4429+
class Inner[T]: ...
4430+
44284431
[out]
44294432
class C[T]: ...
44304433
class C1[T1](int): ...
44314434
class C2[T2: int]: ...
44324435
class C3[T3: str | bytes]: ...
44334436
class C4[T4: (str, bytes)]: ...
44344437

4438+
class Outer:
4439+
class Inner[T]: ...
4440+
44354441
[case testPEP695GenericFunction]
44364442
# flags: --python-version=3.12
44374443

@@ -4440,12 +4446,18 @@ def f2[T2: int](): ...
44404446
def f3[T3: str | bytes](): ...
44414447
def f4[T4: (str, bytes)](): ...
44424448

4449+
class C:
4450+
def m[T](self, x: T) -> T: ...
4451+
44434452
[out]
44444453
def f1[T1]() -> None: ...
44454454
def f2[T2: int]() -> None: ...
44464455
def f3[T3: str | bytes]() -> None: ...
44474456
def f4[T4: (str, bytes)]() -> None: ...
44484457

4458+
class C:
4459+
def m[T](self, x: T) -> T: ...
4460+
44494461
[case testPEP695TypeAlias]
44504462
# flags: --python-version=3.12
44514463

@@ -4455,12 +4467,17 @@ type Alias2[T2: int] = list[T2] | set[T2]
44554467
type Alias3[T3: str | bytes] = list[T3] | set[T3]
44564468
type Alias4[T4: (str, bytes)] = list[T4] | set[T4]
44574469

4470+
class C:
4471+
type IndentedAlias[T] = list[T]
4472+
44584473
[out]
44594474
type Alias = int | str
44604475
type Alias1[T1] = list[T1] | set[T1]
44614476
type Alias2[T2: int] = list[T2] | set[T2]
44624477
type Alias3[T3: str | bytes] = list[T3] | set[T3]
44634478
type Alias4[T4: (str, bytes)] = list[T4] | set[T4]
4479+
class C:
4480+
type IndentedAlias[T] = list[T]
44644481

44654482
[case testPEP695Syntax_semanal]
44664483
# flags: --python-version=3.12

0 commit comments

Comments
 (0)