diff --git a/requirements.dev.txt b/requirements.dev.txt index 76d4e012f5485f13880392b05f6c4cf51ca29428..5a087902f28c55bf51251eb0e17a1b60870003fd 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -8,3 +8,4 @@ pytest-cov==2.4.0 pytest-mock==1.10.0 six==1.10.0 urwid==1.3.1 +numpy \ No newline at end of file diff --git a/test/test_var_view.py b/test/test_var_view.py index 8d4f3856a7ca4ef90381b5a9e2d66646a07ddebc..7294e59a53429797f965138f6ffa2f464a3a7915 100644 --- a/test/test_var_view.py +++ b/test/test_var_view.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- from pudb.py3compat import text_type -import numpy as np class A: @@ -14,11 +13,17 @@ class A2(object): def test_get_stringifier(): from pudb.var_view import InspectInfo, get_stringifier + try: + import numpy as np + except ImportError: + numpy_values = [] + else: + numpy_values = [np.float32(5), np.zeros(5)] + for value in [ A, A2, A(), A2(), u"lól".encode('utf8'), u"lól", 1233123, [u"lól".encode('utf8'), u"lól"], - np.float32(5), np.zeros(5), - ]: + ] + numpy_values: for display_type in ["type", "repr", "str"]: iinfo = InspectInfo() iinfo.display_type = display_type @@ -27,5 +32,3 @@ def test_get_stringifier(): s = strifier(value) assert isinstance(s, text_type) - -test_get_stringifier()