Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Comment thread
timotheeguerin marked this conversation as resolved.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ describe("Python Class Members", () => {
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing import Optional
from typing import Optional


@dataclass(kw_only=True)
class MyModel:
name: str = "default"
description: Optional[str] = "optional with default"
empty_string: str = ""
name: str = "default"
description: Optional[str] = "optional with default"
empty_string: str = ""

`,
);
Expand All @@ -49,14 +49,14 @@ describe("Python Class Members", () => {
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from typing import Optional
from typing import Optional


@dataclass(kw_only=True)
class BooleanModel:
is_active: bool = True
is_deleted: bool = False
optional: Optional[bool] = True
is_active: bool = True
is_deleted: bool = False
optional: Optional[bool] = True

`,
);
Expand All @@ -78,9 +78,9 @@ describe("Python Class Members", () => {

@dataclass(kw_only=True)
class ArrayModel:
tags: list[str] = ["tag1", "tag2"]
empty_array: list[int] = []
numbers: list[int] = [1, 2, 3]
tags: list[str] = ["tag1", "tag2"]
empty_array: list[int] = []
numbers: list[int] = [1, 2, 3]

`,
);
Expand All @@ -104,11 +104,11 @@ describe("Python Class Members", () => {

@dataclass(kw_only=True)
class IntegerModel:
count: int = 42
big_number: int = 1000000
small_number: int = 127
unsigned_value: int = 100
safe_int_value: int = 999
count: int = 42
big_number: int = 1000000
small_number: int = 127
unsigned_value: int = 100
safe_int_value: int = 999

`,
);
Expand Down Expand Up @@ -149,23 +149,23 @@ describe("Python Class Members", () => {
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from decimal import Decimal
from decimal import Decimal


@dataclass(kw_only=True)
class NumericDefaults:
float_base: float = 1.5
float32_value: float = 2.5
float64_value: float = 3.5
custom_float_value: float = 4.5
float_int: float = 10.0
float32_int: float = 20.0
float64_int: float = 30.0
decimal_base: Decimal = 100.25
decimal128_value: Decimal = 200.75
custom_decimal_value: Decimal = 300.125
decimal_int: Decimal = 400.0
decimal128_int: Decimal = 500.0
float_base: float = 1.5
float32_value: float = 2.5
float64_value: float = 3.5
custom_float_value: float = 4.5
float_int: float = 10.0
float32_int: float = 20.0
float64_int: float = 30.0
decimal_base: Decimal = 100.25
decimal128_value: Decimal = 200.75
custom_decimal_value: Decimal = 300.125
decimal_int: Decimal = 400.0
decimal128_int: Decimal = 500.0

`,
);
Expand All @@ -188,16 +188,16 @@ describe("Python Class Members", () => {
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from decimal import Decimal
from decimal import Decimal


@dataclass(kw_only=True)
class MixedNumeric:
int_value: int = 100
int64_value: int = 100
float_value: float = 100.0
float64_value: float = 100.0
decimal_value: Decimal = 100.0
int_value: int = 100
int64_value: int = 100
float_value: float = 100.0
float64_value: float = 100.0
decimal_value: Decimal = 100.0

`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
async def get_name(self, id: str) -> str:
pass
async def get_name(self, id: str) -> str:
pass


`);
Expand All @@ -41,9 +41,9 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
@classmethod
async def get_name(cls, id: str) -> str:
pass
@classmethod
async def get_name(cls, id: str) -> str:
pass


`);
Expand All @@ -62,9 +62,9 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
@staticmethod
async def get_name(id: str) -> str:
pass
@staticmethod
async def get_name(id: str) -> str:
pass


`);
Expand All @@ -83,8 +83,8 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
async def get_name(self, id: str) -> str:
pass
async def get_name(self, id: str) -> str:
pass


`);
Expand All @@ -103,8 +103,8 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
def get_name(self, id: str, *, foo: str) -> str:
pass
def get_name(self, id: str, *, foo: str) -> str:
pass


`);
Expand All @@ -123,8 +123,8 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
def get_name(self, id: str, *, foo: str) -> str:
pass
def get_name(self, id: str, *, foo: str) -> str:
pass


`);
Expand All @@ -150,8 +150,8 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
def get_name(self, *, foo: str, bar: float) -> str:
pass
def get_name(self, *, foo: str, bar: float) -> str:
pass


`);
Expand All @@ -177,8 +177,8 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
def get_name(self, *, foo: str = "default", bar: float = 42) -> str:
pass
def get_name(self, *, foo: str = "default", bar: float = 42) -> str:
pass


`);
Expand All @@ -197,8 +197,8 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
def get_name(self, id: str) -> ASpecialString:
pass
def get_name(self, id: str) -> ASpecialString:
pass


`);
Expand All @@ -217,8 +217,8 @@ describe("interface methods with a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
def get_name_custom(self, id: str) -> str:
pass
def get_name_custom(self, id: str) -> str:
pass


`);
Expand All @@ -241,8 +241,8 @@ describe("interface methods without a `type` prop", () => {
]),
).toRenderTo(`
class BasicInterface:
def plain_method(self, param1: string) -> number:
pass
def plain_method(self, param1: string) -> number:
pass


`);
Expand Down
Loading
Loading