@@ -576,7 +576,7 @@ def test_union_multiple(schema_simp_pop):
576
576
class TestDjTop :
577
577
"""TODO: migrate"""
578
578
579
- def test_restrictions_by_top (self ):
579
+ def test_restrictions_by_top (self , schema_simp_pop ):
580
580
a = L () & dj .Top ()
581
581
b = L () & dj .Top (order_by = ["cond_in_l" , "KEY" ])
582
582
x = L () & dj .Top (5 , "id_l desc" , 4 ) & "cond_in_l=1"
@@ -613,7 +613,7 @@ def test_restrictions_by_top(self):
613
613
{"id_l" : 20 , "cond_in_l" : 1 },
614
614
]
615
615
616
- def test_top_restriction_with_keywords (self ):
616
+ def test_top_restriction_with_keywords (self , schema_simp_pop ):
617
617
select = SelectPK () & dj .Top (limit = 9 , order_by = ["select desc" ])
618
618
key = KeyPK () & dj .Top (limit = 9 , order_by = "key desc" )
619
619
assert select .fetch (as_dict = True ) == [
@@ -639,26 +639,26 @@ def test_top_restriction_with_keywords(self):
639
639
{"id" : 2 , "key" : 3 },
640
640
]
641
641
642
- def test_top_errors (self ):
643
- with assert_raises (DataJointError ) as err1 :
642
+ def test_top_errors (self , schema_simp_pop ):
643
+ with pytest . raises (DataJointError ) as err1 :
644
644
L () & ("cond_in_l=1" , dj .Top ())
645
- with assert_raises (DataJointError ) as err2 :
645
+ with pytest . raises (DataJointError ) as err2 :
646
646
L () & dj .AndList (["cond_in_l=1" , dj .Top ()])
647
- with assert_raises (TypeError ) as err3 :
647
+ with pytest . raises (TypeError ) as err3 :
648
648
L () & dj .Top (limit = "1" )
649
- with assert_raises (TypeError ) as err4 :
649
+ with pytest . raises (TypeError ) as err4 :
650
650
L () & dj .Top (order_by = 1 )
651
- with assert_raises (TypeError ) as err5 :
651
+ with pytest . raises (TypeError ) as err5 :
652
652
L () & dj .Top (offset = "1" )
653
653
assert (
654
- "Invalid restriction type Top(limit=1, order_by=['KEY'], offset=0)"
655
- == str (err1 .exception )
654
+ "datajoint.errors.DataJointError: Invalid restriction type Top(limit=1, order_by=['KEY'], offset=0)"
655
+ == str (err1 .exconly () )
656
656
)
657
657
assert (
658
- "Invalid restriction type Top(limit=1, order_by=['KEY'], offset=0)"
659
- == str (err2 .exception )
658
+ "datajoint.errors.DataJointError: Invalid restriction type Top(limit=1, order_by=['KEY'], offset=0)"
659
+ == str (err2 .exconly () )
660
660
)
661
- assert "Top limit must be an integer" == str (err3 .exception )
662
- assert "Top order_by attributes must all be strings" == str (
663
- err4 .exception )
664
- assert "The offset argument must be an integer" == str (err5 .exception )
661
+ assert "TypeError: Top limit must be an integer" == str (err3 .exconly () )
662
+ assert "TypeError: Top order_by attributes must all be strings" == str (
663
+ err4 .exconly () )
664
+ assert "TypeError: The offset argument must be an integer" == str (err5 .exconly () )
0 commit comments