-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for reusing an existing dataclass
- Loading branch information
1 parent
80e52e9
commit 189fadf
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# pylint: disable=unused-variable | ||
|
||
from dataclasses import dataclass, is_dataclass | ||
|
||
from datafiles import decorators | ||
|
||
|
||
def describe_datafile(): | ||
def it_turns_normal_class_into_dataclass(expect): | ||
class Normal: | ||
pass | ||
|
||
cls = decorators.datafile("")(Normal) | ||
|
||
expect(is_dataclass(cls)) == True | ||
|
||
def it_can_reuse_existing_dataclass(expect): | ||
@dataclass | ||
class Existing: | ||
pass | ||
|
||
cls = decorators.datafile("")(Existing) | ||
|
||
expect(id(cls)) == id(Existing) |