Skip to content

Commit

Permalink
Fix condition and test
Browse files Browse the repository at this point in the history
  • Loading branch information
uriyyo committed Nov 10, 2021
1 parent e147cc6 commit 1efd532
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pydantic/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def resolve_annotations(raw_annotations: Dict[str, Type[Any]], module_name: Opti
annotations = {}
for name, value in raw_annotations.items():
if isinstance(value, str):
if sys.version_info >= (3, 9, 8):
if (3, 10) > sys.version_info >= (3, 9, 8) or sys.version_info >= (3, 10, 1):
value = ForwardRef(value, is_argument=False, is_class=True)
elif sys.version_info >= (3, 7):
value = ForwardRef(value, is_argument=False)
Expand Down
1 change: 1 addition & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ class MyOtherModel(MyModel):
assert list(MyOtherModel.__fields__.keys()) == ['c']


@pytest.mark.skipif(sys.version_info > (3, 6))
def test_class_var_as_string():
class MyModel(BaseModel):
a: 'ClassVar[int]' = 1
Expand Down

0 comments on commit 1efd532

Please sign in to comment.