summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTaneli Hukkinen <hukkinj1@users.noreply.github.com>2021-02-09 23:10:30 +0200
committerGitHub <noreply@github.com>2021-02-09 15:10:30 -0600
commitf0b4fd40fc4431329754b3be3cec0630827df98c (patch)
tree88048b69dff067a1d860ef599c0464e355f97089 /tests
parent1282379d831ccc4306345fc7fcd09a0026694074 (diff)
downloadimmutables-f0b4fd40fc4431329754b3be3cec0630827df98c.tar.gz
immutables-f0b4fd40fc4431329754b3be3cec0630827df98c.zip
Fix flake8 errors and add it to CI (#45)
* Fix flake8 errors and add it to CI * Use extras for test dependencies Co-authored-by: Fantix King <fantix.king@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test_issue24.py9
-rw-r--r--tests/test_map.py14
-rw-r--r--tests/test_none_keys.py8
3 files changed, 18 insertions, 13 deletions
diff --git a/tests/test_issue24.py b/tests/test_issue24.py
index afe6525..7d51e34 100644
--- a/tests/test_issue24.py
+++ b/tests/test_issue24.py
@@ -51,7 +51,7 @@ class Issue24Base:
d = m.__dump__().splitlines()
self.assertTrue(d)
if d[0].startswith('HAMT'):
- header = d[1] # skip _map.Map.__dump__() header
+ header = d[1] # skip _map.Map.__dump__() header
else:
header = d[0]
self.dump_check_bitmap_node_count(header, 7)
@@ -66,7 +66,7 @@ class Issue24Base:
d = m2.__dump__().splitlines()
self.assertTrue(d)
if d[0].startswith('HAMT'):
- header = d[1] # skip _map.Map.__dump__() header
+ header = d[1] # skip _map.Map.__dump__() header
else:
header = d[0]
self.dump_check_bitmap_node_count(header, 4)
@@ -79,7 +79,7 @@ class Issue24Base:
self.assertTrue(len(d) > 3)
# get node headers
if d[0].startswith('HAMT'):
- h1, h2 = d[1], d[3] # skip _map.Map.__dump__() header
+ h1, h2 = d[1], d[3] # skip _map.Map.__dump__() header
else:
h1, h2 = d[0], d[2]
self.dump_check_node_kind(h1, 'Bitmap')
@@ -96,12 +96,13 @@ class Issue24Base:
self.assertTrue(len(d) > 3)
# get node headers
if d[0].startswith('HAMT'):
- h1, h2 = d[1], d[3] # skip _map.Map.__dump__() header
+ h1, h2 = d[1], d[3] # skip _map.Map.__dump__() header
else:
h1, h2 = d[0], d[2]
self.dump_check_node_kind(h1, 'Bitmap')
self.dump_check_collision_node_count(h2, 4)
+
try:
from immutables._map import Map as CMap
except ImportError:
diff --git a/tests/test_map.py b/tests/test_map.py
index 4a473b3..9fffd8c 100644
--- a/tests/test_map.py
+++ b/tests/test_map.py
@@ -7,7 +7,12 @@ import unittest
import weakref
from immutables.map import Map as PyMap
-from immutables._testutils import * # NoQA
+from immutables._testutils import EqError
+from immutables._testutils import HashKey
+from immutables._testutils import HashKeyCrasher
+from immutables._testutils import HashingError
+from immutables._testutils import KeyStr
+from immutables._testutils import ReprError
class BaseMapTest:
@@ -159,8 +164,6 @@ class BaseMapTest:
# <Key name:E hash:362244>: 'e'
# <Key name:B hash:101>: 'b'
-
-
def test_map_stress_01(self):
COLLECTION_SIZE = 7000
TEST_ITERS_EVERY = 647
@@ -1235,7 +1238,6 @@ class BaseMapTest:
# node to be converted into an array node
h = h.set(HashKey(i, i), i)
-
h = h.set(HashKey(18, '18-collision'), 18)
with h.mutate() as m:
@@ -1348,7 +1350,9 @@ class BaseMapTest:
with self.assertRaisesRegex(TypeError, "can('t|not) pickle"):
pickle.dumps(h.mutate())
- @unittest.skipIf(sys.version_info < (3, 7, 0), "__class_getitem__ is not available")
+ @unittest.skipIf(
+ sys.version_info < (3, 7, 0), "__class_getitem__ is not available"
+ )
def test_map_is_subscriptable(self):
self.assertIs(self.Map[int, str], self.Map)
diff --git a/tests/test_none_keys.py b/tests/test_none_keys.py
index 92e7813..8c0bb37 100644
--- a/tests/test_none_keys.py
+++ b/tests/test_none_keys.py
@@ -1,7 +1,7 @@
import unittest
from immutables.map import map_hash, map_mask, Map as PyMap
-from immutables._testutils import * # NoQA
+from immutables._testutils import HashKey
none_hash = map_hash(None)
@@ -342,7 +342,7 @@ class BaseNoneTest:
self.assertTrue(key4 in m3)
self.assertEqual(m3[key2], 2)
self.assertEqual(m3[key4], 4)
- self.assertFalse(None in m3)
+ self.assertFalse(None in m3)
with self.assertRaises(KeyError):
m3.delete(None)
@@ -352,7 +352,7 @@ class BaseNoneTest:
self.assertTrue(key4 in m3)
self.assertEqual(m3[None], 9)
self.assertEqual(m3[key4], 4)
- self.assertFalse(key2 in m3)
+ self.assertFalse(key2 in m3)
with self.assertRaises(KeyError):
m3.delete(key2)
@@ -362,7 +362,7 @@ class BaseNoneTest:
self.assertTrue(key2 in m3)
self.assertEqual(m3[None], 9)
self.assertEqual(m3[key2], 2)
- self.assertFalse(key4 in m3)
+ self.assertFalse(key4 in m3)
with self.assertRaises(KeyError):
m3.delete(key4)