Skip to content

Commit 5d2b1f7

Browse files
committed
Migrate test_uuid
1 parent 5f439c6 commit 5d2b1f7

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

tests/test_uuid.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
from nose.tools import assert_true, assert_equal, raises
1+
import pytest
22
import uuid
33
from .schema_uuid import Basic, Item, Topic
44
from datajoint import DataJointError
55
from itertools import count
66

77

8-
def test_uuid():
8+
def test_uuid(schema_uuid):
99
"""test inserting and fetching of UUID attributes and restricting by UUID attributes"""
1010
u, n = uuid.uuid4(), -1
1111
Basic().insert1(dict(item=u, number=n))
@@ -16,7 +16,7 @@ def test_uuid():
1616
assert u == item
1717

1818

19-
def test_string_uuid():
19+
def test_string_uuid(schema_uuid):
2020
"""test that only UUID objects are accepted when inserting UUID fields"""
2121
u, n = "00000000-0000-0000-0000-000000000000", 24601
2222
Basic().insert1(dict(item=u, number=n))
@@ -25,35 +25,35 @@ def test_string_uuid():
2525
assert isinstance(k["item"], uuid.UUID)
2626

2727

28-
@raises(DataJointError)
29-
def test_invalid_uuid_insert1():
28+
def test_invalid_uuid_insert1(schema_uuid):
3029
"""test that only UUID objects are accepted when inserting UUID fields"""
3130
u, n = 0, 24601
32-
Basic().insert1(dict(item=u, number=n))
31+
with pytest.raises(DataJointError):
32+
Basic().insert1(dict(item=u, number=n))
3333

3434

35-
@raises(DataJointError)
36-
def test_invalid_uuid_insert2():
35+
def test_invalid_uuid_insert2(schema_uuid):
3736
"""test that only UUID objects are accepted when inserting UUID fields"""
3837
u, n = "abc", 24601
39-
Basic().insert1(dict(item=u, number=n))
38+
with pytest.raises(DataJointError):
39+
Basic().insert1(dict(item=u, number=n))
4040

4141

42-
@raises(DataJointError)
43-
def test_invalid_uuid_restrict1():
42+
def test_invalid_uuid_restrict1(schema_uuid):
4443
"""test that only UUID objects are accepted when inserting UUID fields"""
4544
u = 0
46-
k, m = (Basic & {"item": u}).fetch1("KEY", "number")
45+
with pytest.raises(DataJointError):
46+
k, m = (Basic & {"item": u}).fetch1("KEY", "number")
4747

4848

49-
@raises(DataJointError)
50-
def test_invalid_uuid_restrict1():
49+
def test_invalid_uuid_restrict1(schema_uuid):
5150
"""test that only UUID objects are accepted when inserting UUID fields"""
5251
u = "abc"
53-
k, m = (Basic & {"item": u}).fetch1("KEY", "number")
52+
with pytest.raises(DataJointError):
53+
k, m = (Basic & {"item": u}).fetch1("KEY", "number")
5454

5555

56-
def test_uuid_dependencies():
56+
def test_uuid_dependencies(schema_uuid):
5757
"""test the use of UUID in foreign keys"""
5858
for word in (
5959
"Neuroscience",

0 commit comments

Comments
 (0)