Skip to content

Commit df685ea

Browse files
committed
modernize tests
1 parent e9bb3ec commit df685ea

File tree

6 files changed

+17
-7
lines changed

6 files changed

+17
-7
lines changed

schema_salad/tests/test_cli_args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import absolute_import
12
import unittest
23
import sys
34

schema_salad/tests/test_errors.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
from __future__ import absolute_import
2+
from __future__ import print_function
13
from .util import get_data
24
import unittest
35
from typing import cast
46
from schema_salad.schema import load_schema, load_and_validate
57
from schema_salad.validate import ValidationException
68
from avro.schema import Names
9+
import six
710

811
class TestErrors(unittest.TestCase):
912
def test_errors(self):
@@ -28,7 +31,7 @@ def test_errors(self):
2831
with self.assertRaises(ValidationException):
2932
try:
3033
load_and_validate(document_loader, avsc_names,
31-
unicode(get_data("tests/"+t)), True)
34+
six.text_type(get_data("tests/"+t)), True)
3235
except ValidationException as e:
33-
print("\n", e)
36+
print(("\n", e))
3437
raise

schema_salad/tests/test_examples.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import absolute_import
2+
from __future__ import print_function
13
from .util import get_data
24
import unittest
35
import schema_salad.ref_resolver
@@ -285,7 +287,7 @@ def test_scoped_id(self):
285287
}, ra)
286288

287289
g = makerdf(None, ra, ctx)
288-
print(g.serialize(format="n3"))
290+
print((g.serialize(format="n3")))
289291

290292
ra, _ = ldr.resolve_all(cmap({
291293
"location": "foo",
@@ -299,7 +301,7 @@ def test_scoped_id(self):
299301
}, ra)
300302

301303
g = makerdf(None, ra, ctx)
302-
print(g.serialize(format="n3"))
304+
print((g.serialize(format="n3")))
303305

304306
ra, _ = ldr.resolve_all(cmap({
305307
"id": "foo",
@@ -313,7 +315,7 @@ def test_scoped_id(self):
313315
}, ra)
314316

315317
g = makerdf(None, ra, ctx)
316-
print(g.serialize(format="n3"))
318+
print((g.serialize(format="n3")))
317319

318320
ra, _ = ldr.resolve_all(cmap({
319321
"location": "foo",
@@ -327,7 +329,7 @@ def test_scoped_id(self):
327329
}, ra)
328330

329331
g = makerdf(None, ra, ctx)
330-
print(g.serialize(format="n3"))
332+
print((g.serialize(format="n3")))
331333

332334
def test_mixin(self):
333335
base_url = "file://" + os.getcwd() + "/tests/"

schema_salad/tests/test_fetch.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from __future__ import absolute_import
2+
from __future__ import print_function
13
import unittest
24
import schema_salad.ref_resolver
35
import schema_salad.main
@@ -52,6 +54,6 @@ def test_cache(self):
5254
loader = schema_salad.ref_resolver.Loader({})
5355
foo = "file://%s/foo.txt" % os.getcwd()
5456
loader.cache.update({foo: "hello: foo"})
55-
print(loader.cache)
57+
print((loader.cache))
5658
self.assertEqual({"hello": "foo"}, loader.resolve_ref("foo.txt")[0])
5759
self.assertTrue(loader.check_exists(foo))

schema_salad/tests/test_ref_resolver.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Test the ref_resolver module."""
22

3+
from __future__ import absolute_import
34
import shutil
45
import tempfile
56

schema_salad/tests/util.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import absolute_import
12
from pkg_resources import Requirement, resource_filename, ResolutionError # type: ignore
23
from typing import Optional, Text
34
import os

0 commit comments

Comments
 (0)