Skip to content

Commit

Permalink
Add test for issue numba#4520
Browse files Browse the repository at this point in the history
  • Loading branch information
sklam committed Sep 26, 2019
1 parent 3a6f134 commit 85d5cf5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions numba/tests/test_dictobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,22 @@ def foo(d):
# Value is correctly updated
self.assertPreciseEqual(d[1], np.arange(10, dtype=np.int64) + 100)

def test_storage_model_mismatch(self):
# https://github.com/numba/numba/issues/4520
# check for storage model mismatch in refcount ops generation
dct = Dict()
ref = [
("a", True, "a"),
("b", False, "b"),
("c", False, "c"),
]
# populate
for x in ref:
dct[x] = x
# test
for i, x in enumerate(ref):
self.assertEqual(dct[x], x)


class TestDictForbiddenTypes(TestCase):
def assert_disallow(self, expect, callable):
Expand Down
16 changes: 16 additions & 0 deletions numba/tests/test_typedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,3 +742,19 @@ def bag_equal(one, two):
np.testing.assert_allclose(one.array, two.array)

[bag_equal(a, b) for a, b in zip(expected, got)]

def test_storage_model_mismatch(self):
# https://github.com/numba/numba/issues/4520
# check for storage model mismatch in refcount ops generation
lst = List()
ref = [
("a", True, "a"),
("b", False, "b"),
("c", False, "c"),
]
# populate
for x in ref:
lst.append(x)
# test
for i, x in enumerate(ref):
self.assertEqual(lst[i], ref[i])

0 comments on commit 85d5cf5

Please sign in to comment.