Skip to content

Commit

Permalink
Test for #5952
Browse files Browse the repository at this point in the history
As title
  • Loading branch information
stuartarchibald committed Jul 7, 2020
1 parent 5a794d2 commit 3523ea5
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion numba/tests/test_errorhandling.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
from numba.core.compiler_machinery import PassManager
from numba.core.types.functions import _err_reasons as error_reasons

from numba.tests.support import skip_parfors_unsupported
from numba.tests.support import (skip_parfors_unsupported, override_config,
SerialMixin)
import unittest

# used in TestMiscErrorHandling::test_handling_of_write_to_*_global
Expand Down Expand Up @@ -423,5 +424,22 @@ def foo():
self.assertIn("Type Restricted Function in function 'unknown'", excstr)


class TestDeveloperSpecificErrorMessages(SerialMixin, unittest.TestCase):

def test_bound_function_error_string(self):
# See PR #5952
def foo(x):
x.max(-1) # axis not supported

with override_config('DEVELOPER_MODE', 1):
with self.assertRaises(errors.TypingError) as raises:
njit("void(int64[:,:])")(foo)

excstr = str(raises.exception)
self.assertIn("AssertionError()", excstr)
self.assertIn("BoundFunction(array.max for array(int64, 2d, A))",
excstr)


if __name__ == '__main__':
unittest.main()

0 comments on commit 3523ea5

Please sign in to comment.