File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,22 @@ async def test_inherited_base_model_managers_product():
89
89
await Product .query .create (name = "test5" , rating = 2 )
90
90
await Product .query .create (name = "test6" , rating = 1 )
91
91
92
- users = await Product .query .all ()
93
- assert len (users ) == 6
92
+ products = await Product .query .all ()
93
+ assert len (products ) == 6
94
94
95
- users = await Product .ratings .all ()
96
- assert len (users ) == 3
95
+ products = await Product .ratings .all ()
96
+ assert len (products ) == 3
97
+
98
+
99
+ async def test_raises_key_error_on_non_existing_field_for_product ():
100
+ await Product .query .create (name = "test" , rating = 5 )
101
+
102
+ with pytest .raises (KeyError ):
103
+ await Product .languages .all ()
104
+
105
+
106
+ async def test_raises_key_error_on_non_existing_field_for_user ():
107
+ await User .query .create (name = "test" , language = "EN" )
108
+
109
+ with pytest .raises (KeyError ):
110
+ await User .ratings .all ()
You can’t perform that action at this time.
0 commit comments