Skip to content

Commit

Permalink
adjust snapshots for 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
mhils committed Aug 13, 2024
1 parent dddc9d0 commit 8da3381
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 147 deletions.
15 changes: 5 additions & 10 deletions test/test_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def outfile(self, format: str) -> Path:
snapshots = [
Snapshot("ast_parsing"),
Snapshot("demo", min_version=(3, 9)),
Snapshot("enums", min_version=(3, 12)),
Snapshot("enums", min_version=(3, 13)),
Snapshot("flavors_google"),
Snapshot("flavors_numpy"),
Snapshot("flavors_rst"),
Expand Down Expand Up @@ -135,16 +135,10 @@ def outfile(self, format: str) -> Path:
with_output_directory=True,
),
Snapshot("misc"),
Snapshot(
"misc_py39",
min_version=(3, 9),
),
Snapshot("misc_py39", min_version=(3, 9)),
Snapshot("misc_py310", min_version=(3, 10)),
Snapshot("misc_py311", min_version=(3, 11)),
Snapshot(
"misc_py312",
min_version=(3, 12),
),
Snapshot("misc_py312", min_version=(3, 12)),
Snapshot("misc_py313", min_version=(3, 13)),
Snapshot("math_demo", render_options={"math": True}),
Snapshot("math_misc", render_options={"math": True}),
Snapshot("mermaid_demo", render_options={"mermaid": True}, min_version=(3, 9)),
Expand All @@ -165,6 +159,7 @@ def outfile(self, format: str) -> Path:
Snapshot("top_level_reimports", ["top_level_reimports"]),
Snapshot("type_checking_imports", ["type_checking_imports.main"]),
Snapshot("type_stub", min_version=(3, 10)),
Snapshot("typed_dict", min_version=(3, 13)),
Snapshot(
"visibility",
render_options={
Expand Down
2 changes: 2 additions & 0 deletions test/testdata/flavors_google.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ def __init__(self, msg, code):
def add_note(self, note: str):
"""This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""

def with_traceback(self, object, /):
"""This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""

class ExampleClass(object):
"""The summary line for a class docstring should fit on one line.
Expand Down
2 changes: 2 additions & 0 deletions test/testdata/flavors_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ def __init__(self, msg, code):
def add_note(self, note: str):
"""This method is present on Python 3.11+ and manually added here so that snapshots are consistent."""

def with_traceback(self, object, /):
"""This method has a changed docstring in Python 3.13+ and is manually added here so that snapshots are consistent."""

class ExampleClass(object):
"""The summary line for a class docstring should fit on one line.
Expand Down
5 changes: 0 additions & 5 deletions test/testdata/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,6 @@ def dynamically_modify_docstring4():
pass


class MyDict(dict):
pass


class DocstringFromNew:
def __new__(cls, *args, **kwargs):
"""This is a class with a docstring inferred from `__new__`."""
Expand Down Expand Up @@ -475,6 +471,5 @@ def __new__(cls, *args, **kwargs):
"dynamically_modify_docstring2",
"dynamically_modify_docstring3",
"dynamically_modify_docstring4",
"MyDict",
"DocstringFromNew",
]
100 changes: 0 additions & 100 deletions test/testdata/misc_py311.html

This file was deleted.

8 changes: 0 additions & 8 deletions test/testdata/misc_py311.txt

This file was deleted.

22 changes: 0 additions & 22 deletions test/testdata/misc_py312.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,3 @@ class NamedTupleExample(NamedTuple):
name: str
"""Name of our example tuple."""
id: int = 3


# Testing some edge cases in our inlined implementation of ForwardRef._evaluate in _eval_type.
class Foo(TypedDict):
a: Optional[int]
"""First attribute."""


class Bar(Foo, total=False):
"""A TypedDict subclass. Before 3.12, TypedDict botches __mro__."""

b: int
"""Second attribute."""
c: str
# undocumented attribute


class Baz(Bar):
"""A TypedDict subsubclass."""

d: bool
"""new attribute"""
4 changes: 2 additions & 2 deletions test/testdata/misc_py311.py → test/testdata/misc_py313.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Testing that Exceptions render properly

class MyDict(dict):
pass

class CustomException(RuntimeError):
"""custom exception type"""
22 changes: 22 additions & 0 deletions test/testdata/typed_dict.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from typing import TypedDict
from typing import Optional

class Foo(TypedDict):
a: Optional[int]
"""First attribute."""


class Bar(Foo, total=False):
"""A TypedDict subclass. Before 3.12, TypedDict botches __mro__."""

b: int
"""Second attribute."""
c: str
# undocumented attribute


class Baz(Bar):
"""A TypedDict subsubclass."""

d: bool
"""new attribute"""

0 comments on commit 8da3381

Please sign in to comment.