summaryrefslogtreecommitdiff
path: root/test/base/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/base/test_utils.py')
-rw-r--r--test/base/test_utils.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/test/base/test_utils.py b/test/base/test_utils.py
index 349ee8c05..b979d43bc 100644
--- a/test/base/test_utils.py
+++ b/test/base/test_utils.py
@@ -1,5 +1,3 @@
-#! coding: utf-8
-
import copy
import inspect
from pathlib import Path
@@ -543,7 +541,7 @@ class ToListTest(fixtures.TestBase):
eq_(util.to_list("xyz"), ["xyz"])
def test_from_set(self):
- spec = util.to_list(set([1, 2, 3]))
+ spec = util.to_list({1, 2, 3})
assert isinstance(spec, list)
eq_(sorted(spec), [1, 2, 3])
@@ -567,7 +565,7 @@ class ToListTest(fixtures.TestBase):
class ColumnCollectionCommon(testing.AssertsCompiledSQL):
def _assert_collection_integrity(self, coll):
- eq_(coll._colset, set(c for k, c, _ in coll._collection))
+ eq_(coll._colset, {c for k, c, _ in coll._collection})
d = {}
for k, col, _ in coll._collection:
d.setdefault(k, (k, col))
@@ -1964,7 +1962,7 @@ class IdentitySetTest(fixtures.TestBase):
assert True
try:
- s = set([o1, o2])
+ s = {o1, o2}
s |= ids
assert False
except TypeError:
@@ -2019,7 +2017,7 @@ class OrderedIdentitySetTest(fixtures.TestBase):
class DictlikeIteritemsTest(fixtures.TestBase):
- baseline = set([("a", 1), ("b", 2), ("c", 3)])
+ baseline = {("a", 1), ("b", 2), ("c", 3)}
def _ok(self, instance):
iterator = util.dictlike_iteritems(instance)
@@ -2966,7 +2964,7 @@ class GenericReprTest(fixtures.TestBase):
self.e = e
self.f = f
self.g = g
- super(Bar, self).__init__(**kw)
+ super().__init__(**kw)
eq_(
util.generic_repr(
@@ -2989,7 +2987,7 @@ class GenericReprTest(fixtures.TestBase):
class Bar(Foo):
def __init__(self, b=3, c=4, **kw):
self.c = c
- super(Bar, self).__init__(b=b, **kw)
+ super().__init__(b=b, **kw)
eq_(
util.generic_repr(Bar(a="a", b="b", c="c"), to_inspect=[Bar, Foo]),
@@ -3125,7 +3123,7 @@ class AsInterfaceTest(fixtures.TestBase):
def assertAdapted(obj, *methods):
assert isinstance(obj, type)
- found = set([m for m in dir(obj) if not m.startswith("_")])
+ found = {m for m in dir(obj) if not m.startswith("_")}
for method in methods:
assert method in found
found.remove(method)
@@ -3163,7 +3161,7 @@ class AsInterfaceTest(fixtures.TestBase):
class TestClassHierarchy(fixtures.TestBase):
def test_object(self):
- eq_(set(util.class_hierarchy(object)), set((object,)))
+ eq_(set(util.class_hierarchy(object)), {object})
def test_single(self):
class A:
@@ -3172,14 +3170,14 @@ class TestClassHierarchy(fixtures.TestBase):
class B:
pass
- eq_(set(util.class_hierarchy(A)), set((A, object)))
- eq_(set(util.class_hierarchy(B)), set((B, object)))
+ eq_(set(util.class_hierarchy(A)), {A, object})
+ eq_(set(util.class_hierarchy(B)), {B, object})
class C(A, B):
pass
- eq_(set(util.class_hierarchy(A)), set((A, B, C, object)))
- eq_(set(util.class_hierarchy(B)), set((A, B, C, object)))
+ eq_(set(util.class_hierarchy(A)), {A, B, C, object})
+ eq_(set(util.class_hierarchy(B)), {A, B, C, object})
class TestClassProperty(fixtures.TestBase):
@@ -3190,7 +3188,7 @@ class TestClassProperty(fixtures.TestBase):
class B(A):
@classproperty
def something(cls):
- d = dict(super(B, cls).something)
+ d = dict(super().something)
d.update({"bazz": 2})
return d
@@ -3319,7 +3317,7 @@ class BackslashReplaceTest(fixtures.TestBase):
def test_utf8_to_utf8(self):
eq_(
compat.decode_backslashreplace(
- "some message méil".encode("utf-8"), "utf-8"
+ "some message méil".encode(), "utf-8"
),
"some message méil",
)