File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,36 +48,38 @@ async def test_operators(self):
4848 """Test for operators."""
4949 logger .info ('Testing operators...' )
5050 today = datetime .today ()
51- post_with_topic = await Post (
51+ post_with_topic = Post (
5252 title = 'Lorem ipsum' ,
5353 body = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' ,
5454 rating = 4 ,
5555 user_id = 1 ,
5656 topic = 'Some topic' ,
57- ). save ()
58- post_without_topic = await Post (
57+ )
58+ post_without_topic = Post (
5959 title = 'Lorem ipsum' ,
6060 body = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' ,
6161 rating = 4 ,
6262 user_id = 1 ,
63- ). save ()
63+ )
6464
65- self .assertTrue (
66- all (
67- [
68- post .topic is None
69- for post in await Post .where (topic__isnull = True ).all ()
70- ]
65+ async with post_with_topic , post_without_topic :
66+ self .assertTrue (
67+ all (
68+ [
69+ post .topic is None
70+ for post in await Post .where (topic__isnull = True ).all ()
71+ ]
72+ )
7173 )
72- )
73- self . assertTrue (
74- all (
75- [
76- post . topic is not None
77- for post in await Post . where ( topic__isnull = False ). all ()
78- ]
74+ self . assertTrue (
75+ all (
76+ [
77+ post . topic is not None
78+ for post in await Post . where ( topic__isnull = False ). all ()
79+ ]
80+ )
7981 )
80- )
82+
8183 self .assertTrue (
8284 all (
8385 [
@@ -381,9 +383,6 @@ async def test_operators(self):
381383 )
382384 )
383385
384- # clean up
385- await Post .delete_all ([post_with_topic , post_without_topic ])
386-
387386 async def test_filter_expr (self ):
388387 """Test for ``filter_expr`` function."""
389388 logger .info ('Testing "filter_expr" function...' )
You can’t perform that action at this time.
0 commit comments