mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Dataclass 3.7 mode without Final
This commit is contained in:
@@ -390,14 +390,22 @@ def test_wraps_signature(Script, code, signature):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_dataclass_signature(
|
def test_dataclass_signature(
|
||||||
Script, skip_pre_python37, start, start_params, include_params
|
Script, skip_pre_python37, start, start_params, include_params, environment
|
||||||
):
|
):
|
||||||
|
if environment.version_info < (3, 8):
|
||||||
|
# Final is not yet supported
|
||||||
|
price_type = "float"
|
||||||
|
price_type_infer = "float"
|
||||||
|
else:
|
||||||
|
price_type = "Final[float]"
|
||||||
|
price_type_infer = "object"
|
||||||
|
|
||||||
code = dedent(
|
code = dedent(
|
||||||
"""
|
f"""
|
||||||
name: str
|
name: str
|
||||||
foo = 3
|
foo = 3
|
||||||
blob: ClassVar[str]
|
blob: ClassVar[str]
|
||||||
price: Final[float]
|
price: {price_type}
|
||||||
quantity: int = 0.0
|
quantity: int = 0.0
|
||||||
|
|
||||||
X("""
|
X("""
|
||||||
@@ -422,7 +430,7 @@ def test_dataclass_signature(
|
|||||||
quantity, = sig.params[-1].infer()
|
quantity, = sig.params[-1].infer()
|
||||||
assert quantity.name == 'int'
|
assert quantity.name == 'int'
|
||||||
price, = sig.params[-2].infer()
|
price, = sig.params[-2].infer()
|
||||||
assert price.name == 'object'
|
assert price.name == price_type_infer
|
||||||
|
|
||||||
|
|
||||||
dataclass_transform_cases = [
|
dataclass_transform_cases = [
|
||||||
|
|||||||
Reference in New Issue
Block a user