Skip to content

Commit

Permalink
Support 2023.3 EAP (#813)
Browse files Browse the repository at this point in the history
* Support 2023.3 EAP

* Fix unittest

* Fix unittest

* Bump version
  • Loading branch information
koxudaxi authored Oct 8, 2023
1 parent 673d1e5 commit 781b6b6
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## [Unreleased]
- Support 2023.3 EAP [[#813](https://github.com/koxudaxi/pydantic-pycharm-plugin/pull/813)]

## [0.4.8] - 2023-09-14

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ pluginVersion = 0.4.8

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 232
pluginUntilBuild = 232.*
pluginUntilBuild = 233.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = PC
platformVersion = 232.7295.8-EAP-SNAPSHOT
platformVersion = 233.9102.128-EAP-SNAPSHOT

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
Expand Down
8 changes: 4 additions & 4 deletions testData/typeinspection/dynamicModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class StaticFoobarModel(BaseModel):


DynamicFoobarModel(foo='name', bar=123)
DynamicFoobarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'str' instead">bar='name'</warning>)
DynamicFoobarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'LiteralString' instead">bar='name'</warning>)

BarModel = create_model(
model_name='BarModel',
Expand All @@ -18,7 +18,7 @@ class StaticFoobarModel(BaseModel):
)

BarModel(foo='name', bar=123, apple='green', banana='red')
BarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'str' instead">bar='name'</warning>, <warning descr="Expected type 'str', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'str', got 'int' instead">banana=456</warning>)
BarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'LiteralString' instead">bar='name'</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">banana=456</warning>)

model_name = 'DynamicBarModel'
DynamicBarModel = create_model(
Expand All @@ -29,12 +29,12 @@ class StaticFoobarModel(BaseModel):
)

DynamicBarModel(foo='name', bar=123, apple='green', banana='red')
DynamicBarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'str' instead">bar='name'</warning>, <warning descr="Expected type 'str', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'str', got 'int' instead">banana=456</warning>)
DynamicBarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'LiteralString' instead">bar='name'</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">banana=456</warning>)

DynamicModifiedBarModel = create_model('DynamicModifiedFoobarModel', foo=(int, ...), bar='abc', __base__=DynamicBarModel)

DynamicModifiedBarModel(foo=456, bar='efg', apple='green', banana='red')
DynamicModifiedBarModel(<warning descr="Expected type 'int', got 'str' instead">foo='123'</warning>, <warning descr="Expected type 'str', got 'int' instead">bar=456</warning>, <warning descr="Expected type 'str', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'str', got 'int' instead">banana=456</warning>)
DynamicModifiedBarModel(<warning descr="Expected type 'int', got 'LiteralString' instead">foo='123'</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">bar=456</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">banana=456</warning>)


DynamicBrokenModel = create_model(
Expand Down
4 changes: 2 additions & 2 deletions testData/typeinspectionv18/dataclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ class ChildDataclass(MyDataclass):
d: int

MyDataclass(a='apple', b=1)
MyDataclass(<warning descr="Expected type 'str', got 'int' instead">a=2</warning>, <warning descr="Expected type 'int', got 'str' instead">b='orange'</warning>)
MyDataclass(<warning descr="Expected type 'str', got 'int' instead">a=2</warning>, <warning descr="Expected type 'int', got 'LiteralString' instead">b='orange'</warning>)

ChildDataclass(a='apple', b=1, c='berry', d=3)
ChildDataclass(<warning descr="Expected type 'str', got 'int' instead">a=2</warning>, <warning descr="Expected type 'int', got 'str' instead">b='orange'</warning>, <warning descr="Expected type 'str', got 'int' instead">c=4</warning>, <warning descr="Expected type 'int', got 'str' instead">d='cherry'</warning>)
ChildDataclass(<warning descr="Expected type 'str', got 'int' instead">a=2</warning>, <warning descr="Expected type 'int', got 'LiteralString' instead">b='orange'</warning>, <warning descr="Expected type 'str', got 'int' instead">c=4</warning>, <warning descr="Expected type 'int', got 'LiteralString' instead">d='cherry'</warning>)


a: MyDataclass = MyDataclass(<warning descr="null">)</warning>
Expand Down
8 changes: 4 additions & 4 deletions testData/typeinspectionv18/dynamicModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class StaticFoobarModel(BaseModel):


DynamicFoobarModel(foo='name', bar=123)
DynamicFoobarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'str' instead">bar='name'</warning>)
DynamicFoobarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'LiteralString' instead">bar='name'</warning>)

BarModel = create_model(
__model_name='BarModel',
Expand All @@ -18,7 +18,7 @@ class StaticFoobarModel(BaseModel):
)

BarModel(foo='name', bar=123, apple='green', banana='red')
BarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'str' instead">bar='name'</warning>, <warning descr="Expected type 'str', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'str', got 'int' instead">banana=456</warning>)
BarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'LiteralString' instead">bar='name'</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">banana=456</warning>)

model_name = 'DynamicBarModel'
DynamicBarModel = create_model(
Expand All @@ -29,9 +29,9 @@ class StaticFoobarModel(BaseModel):
)

DynamicBarModel(foo='name', bar=123, apple='green', banana='red')
DynamicBarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'str' instead">bar='name'</warning>, <warning descr="Expected type 'str', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'str', got 'int' instead">banana=456</warning>)
DynamicBarModel(<warning descr="Expected type 'str', got 'int' instead">foo=123</warning>, <warning descr="Expected type 'int', got 'LiteralString' instead">bar='name'</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">banana=456</warning>)

DynamicModifiedBarModel = create_model('DynamicModifiedFoobarModel', foo=(int, ...), bar='abc', __base__=DynamicBarModel)

DynamicModifiedBarModel(foo=456, bar='efg', apple='green', banana='red')
DynamicModifiedBarModel(<warning descr="Expected type 'int', got 'str' instead">foo='123'</warning>, <warning descr="Expected type 'str', got 'int' instead">bar=456</warning>, <warning descr="Expected type 'str', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'str', got 'int' instead">banana=456</warning>)
DynamicModifiedBarModel(<warning descr="Expected type 'int', got 'LiteralString' instead">foo='123'</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">bar=456</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">apple=123</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">banana=456</warning>)
18 changes: 9 additions & 9 deletions testData/typeinspectionv18/genericModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ChildClass(BaseClass[int, TypeY], Generic[TypeY, TypeZ]):
# Replace TypeY by str
ChildClass[str, float](x=1, y='y', z=3.1)

ChildClass[float, bytes](<warning descr="Expected type 'int', got 'bytes' instead">x=b'1'</warning>, <warning descr="Expected type 'float', got 'str' instead">y='y'</warning>, <warning descr="Expected type 'bytes', got 'int' instead">z=1_3</warning>)
ChildClass[float, bytes](<warning descr="Expected type 'int', got 'bytes' instead">x=b'1'</warning>, <warning descr="Expected type 'float', got 'LiteralString' instead">y='y'</warning>, <warning descr="Expected type 'bytes', got 'int' instead">z=1_3</warning>)

DataT = TypeVar('DataT')

Expand All @@ -78,7 +78,7 @@ def __concrete_name__(cls: Type[Any], params: Tuple[Type[Any], ...]) -> str:


Response[str](<warning descr="Expected type 'str', got 'int' instead">data=1</warning>)
Response[float](<warning descr="Expected type 'float', got 'str' instead">data='a'</warning>)
Response[float](<warning descr="Expected type 'float', got 'LiteralString' instead">data='a'</warning>)


T = TypeVar('T')
Expand All @@ -97,7 +97,7 @@ class OuterT(GenericModel, Generic[T]):
OuterT[int](outer=1, nested=nested)

nested = InnerT[str](inner='a')
OuterT[int](<warning descr="Expected type 'int', got 'str' instead">outer='a'</warning>, <warning descr="Expected type 'InnerT[int]', got 'InnerT[str]' instead">nested=nested</warning>)
OuterT[int](<warning descr="Expected type 'int', got 'LiteralString' instead">outer='a'</warning>, <warning descr="Expected type 'InnerT[int]', got 'InnerT[str]' instead">nested=nested</warning>)

AT = TypeVar('AT')
BT = TypeVar('BT')
Expand All @@ -116,7 +116,7 @@ class Model(GenericModel, Generic[AT, BT]):
typevar_model(a=1, b=1)


typevar_model(<warning descr="Expected type 'int', got 'str' instead">a='a'</warning>, <warning descr="Expected type 'IntT', got 'str' instead">b='a'</warning>)
typevar_model(<warning descr="Expected type 'int', got 'LiteralString' instead">a='a'</warning>, <warning descr="Expected type 'IntT', got 'LiteralString' instead">b='a'</warning>)

concrete_model = typevar_model[int]
concrete_model(a=1, b=1)
Expand All @@ -142,7 +142,7 @@ class Model(GenericModel, Generic[CT, DT]):

Model[int, int](a=[int], b=[2])

Model[int, int](<warning descr="Expected type 'List[Type[int]]', got 'int' instead">a=1</warning>, <warning descr="Expected type 'Union[List[int], float]', got 'str' instead">b='2'</warning>)
Model[int, int](<warning descr="Expected type 'List[Type[int]]', got 'int' instead">a=1</warning>, <warning descr="Expected type 'Union[List[int], float]', got 'LiteralString' instead">b='2'</warning>)

class Model(GenericModel, Generic[CT, DT, ET, FT]):
a: CT
Expand All @@ -167,7 +167,7 @@ class Model(GenericModel, Generic[CT]):

Model[Union[int, float]](a=1)

Model[Union[int, float]](<warning descr="Expected type 'Union[int, float]', got 'str' instead">a='1'</warning>)
Model[Union[int, float]](<warning descr="Expected type 'Union[int, float]', got 'LiteralString' instead">a='1'</warning>)

class Model(GenericModel, Generic[CT, DT]):
a: CT
Expand All @@ -178,7 +178,7 @@ def x(b: ET) -> ET:

Model[x(int), Optional[x(int)]](a=1, b=2)

Model[x(int), Optional[x(int)]](<warning descr="Expected type 'int', got 'str' instead">a='1'</warning>, <warning descr="Expected type 'Optional[int]', got 'str' instead">b='2'</warning>)
Model[x(int), Optional[x(int)]](<warning descr="Expected type 'int', got 'LiteralString' instead">a='1'</warning>, <warning descr="Expected type 'Optional[int]', got 'LiteralString' instead">b='2'</warning>)

class Model(GenericModel, Generic[CT, DT]):
a: CT
Expand All @@ -188,12 +188,12 @@ class Model(GenericModel, Generic[CT, DT]):

Model[y, Optional[y]](a=1, b=2)

Model[y, Optional[y]](<warning descr="Expected type 'int', got 'str' instead">a='1'</warning>, <warning descr="Expected type 'Optional[int]', got 'str' instead">b='2'</warning>)
Model[y, Optional[y]](<warning descr="Expected type 'int', got 'LiteralString' instead">a='1'</warning>, <warning descr="Expected type 'Optional[int]', got 'LiteralString' instead">b='2'</warning>)


class Model(GenericModel, Generic[CT, DT, ET, FT, aaaaaaaaaa]):
a: Type[CT]
b: List[aaaaa]
c: Dict[ET, aaaaaaaa]

Model[aaaaaaaaaa, List[aaaaaa], Tuple[aaaaaaaaaa], Type[aaaaaaaaaaa]](a=int, b=[2], <warning descr="Expected type 'Dict[Tuple[Any], Any]', got 'Dict[str, int]' instead">c={'c': 3}</warning>)
Model[aaaaaaaaaa, List[aaaaaa], Tuple[aaaaaaaaaa], Type[aaaaaaaaaaa]](a=int, b=[2], <warning descr="Expected type 'Dict[Tuple[Any], Any]', got 'Dict[LiteralString, int]' instead">c={'c': 3}</warning>)
2 changes: 1 addition & 1 deletion testData/typeinspectionv18/sqlModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ class Hero(SQLModel, table=True):

hero_4 = Hero(secret_name="test"<warning descr="null">)</warning>

hero_5 = Hero(<warning descr="Expected type 'str', got 'int' instead">name=123</warning>, <warning descr="Expected type 'str', got 'int' instead">secret_name=456</warning>, <warning descr="Expected type 'Optional[int]', got 'str' instead">age="abc"</warning>)
hero_5 = Hero(<warning descr="Expected type 'str', got 'int' instead">name=123</warning>, <warning descr="Expected type 'LiteralString', got 'int' instead">secret_name=456</warning>, <warning descr="Expected type 'Optional[int]', got 'LiteralString' instead">age="abc"</warning>)

0 comments on commit 781b6b6

Please sign in to comment.