@@ -576,7 +576,7 @@ def test_union_multiple(schema_simp_pop):
576576class TestDjTop:
577577 """TODO: migrate"""
578578
579- def test_restrictions_by_top(self):
579+ def test_restrictions_by_top(self, schema_simp_pop ):
580580 a = L() & dj.Top()
581581 b = L() & dj.Top(order_by=["cond_in_l", "KEY"])
582582 x = L() & dj.Top(5, "id_l desc", 4) & "cond_in_l=1"
@@ -613,7 +613,7 @@ def test_restrictions_by_top(self):
613613 {"id_l": 20, "cond_in_l": 1},
614614 ]
615615
616- def test_top_restriction_with_keywords(self):
616+ def test_top_restriction_with_keywords(self, schema_simp_pop ):
617617 select = SelectPK() & dj.Top(limit=9, order_by=["select desc"])
618618 key = KeyPK() & dj.Top(limit=9, order_by="key desc")
619619 assert select.fetch(as_dict=True) == [
@@ -639,26 +639,26 @@ def test_top_restriction_with_keywords(self):
639639 {"id": 2, "key": 3},
640640 ]
641641
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:
644644 L() & ("cond_in_l=1", dj.Top())
645- with assert_raises (DataJointError) as err2:
645+ with pytest.raises (DataJointError) as err2:
646646 L() & dj.AndList(["cond_in_l=1", dj.Top()])
647- with assert_raises (TypeError) as err3:
647+ with pytest.raises (TypeError) as err3:
648648 L() & dj.Top(limit="1")
649- with assert_raises (TypeError) as err4:
649+ with pytest.raises (TypeError) as err4:
650650 L() & dj.Top(order_by=1)
651- with assert_raises (TypeError) as err5:
651+ with pytest.raises (TypeError) as err5:
652652 L() & dj.Top(offset="1")
653653 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() )
656656 )
657657 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() )
660660 )
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