Skip to content

Commit

Permalink
removed example introduced for readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
slawwan committed Nov 22, 2024
1 parent 4bbccfd commit 1435382
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions tests/test_serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,36 +767,3 @@ class GenericContainer(Generic[_TItem]):

assert dumped == {"items": ["q", "w", "e"]}
assert mr.load(GenericContainer[str], dumped) == container_str


def test_sdfdfsd():
import dataclasses
from typing import Generic, TypeVar

import marshmallow_recipe as mr

T = TypeVar("T")

@dataclasses.dataclass()
class Regular(Generic[T]):
value: T

mr.dump(Regular[int](value=123)) # it works without explicit cls arg

@dataclasses.dataclass(frozen=True)
class Frozen(Generic[T]):
value: T

mr.dump(Frozen[int](value=123), cls=Frozen[int]) # cls required generic frozen

@dataclasses.dataclass(slots=True)
class Slots(Generic[T]):
value: T

mr.dump(Slots[int](value=123), cls=Slots[int]) # cls required for generic with slots

@dataclasses.dataclass(slots=True)
class SlotsNonGeneric(Slots[int]):
pass

mr.dump(SlotsNonGeneric(value=123)) # cls not required

0 comments on commit 1435382

Please sign in to comment.