@@ -35,24 +35,30 @@ class PydanticBook(BaseModel):
35
35
36
36
37
37
class ObjectsView (UnicornView ):
38
- unicorn_field = BookField ()
39
- pydantic_field = PydanticBook ()
40
- dictionary = { "name" : "dictionary" , "nested" : { "name" : "nested dictionary" }}
41
- dictionary_2 = { "5" : "a" , "9" : "b" }
42
- book = Book ( title = "The Sandman" )
43
- books = Book . objects . all ()
38
+ unicorn_field = None
39
+ pydantic_field = None
40
+ dictionary = None
41
+ dictionary_2 = None
42
+ book = None
43
+ books = None
44
44
date_example = now ()
45
45
date_example_with_typehint : datetime = now ()
46
- dates_with_no_typehint = []
47
- dates_with_old_typehint : List [datetime ] = []
48
- dates_with_new_typehint : list [datetime ] = []
49
- dates_with_list_typehint : list = []
46
+ dates_with_no_typehint = None
47
+ dates_with_old_typehint : List [datetime ] = None
48
+ dates_with_new_typehint : list [datetime ] = None
49
+ dates_with_list_typehint : list = None
50
50
float_example : float = 1.1
51
51
decimal_example = D ("1.1" )
52
52
int_example = 4
53
53
color = Color .RED
54
54
55
55
def mount (self ):
56
+ self .unicorn_field = BookField ()
57
+ self .pydantic_field = PydanticBook ()
58
+ self .dictionary = {"name" : "dictionary" , "nested" : {"name" : "nested dictionary" }}
59
+ self .dictionary2 = {"5" : "a" , "9" : "b" }
60
+ self .book = Book (title = "The Sandman" )
61
+ self .books = Book .objects .all ()
56
62
self .dates_with_no_typehint = [datetime (2021 , 1 , 1 ), datetime (2021 , 1 , 2 )]
57
63
self .dates_with_old_typehint = [datetime (2022 , 2 , 1 ), datetime (2022 , 2 , 2 )]
58
64
self .dates_with_new_typehint = [datetime (2023 , 3 , 1 ), datetime (2023 , 3 , 2 )]
@@ -65,6 +71,7 @@ def check_date(self, dt: datetime):
65
71
assert type (dt ) is datetime
66
72
67
73
self .date_example = dt
74
+ self .date_example_with_typehint = dt
68
75
69
76
def add_hour (self ):
70
77
self .date_example_with_typehint = self .date_example_with_typehint + timedelta (hours = 1 )
0 commit comments