Skip to content

Commit

Permalink
Fix py2 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 14, 2021
1 parent 6d360b0 commit 25f35ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/API0/teststringparam.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class A(param.Parameterized):

a = A()

exception = "String parameter 's' only takes a string value, not value of type <class 'NoneType'>."
cls = 'class' if sys.version_info.major > 2 else 'type'
exception = "String parameter 's' only takes a string value, not value of type <%s 'NoneType'>." % cls
with self.assertRaisesRegexp(ValueError, exception):
a.s = None # because allow_None should be False

Expand Down
5 changes: 4 additions & 1 deletion tests/API1/teststringparam.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Unit test for String parameters
"""
import sys

from . import API1TestCase

import param
Expand All @@ -23,7 +25,8 @@ class A(param.Parameterized):

a = A()

exception = "String parameter 's' only takes a string value, not value of type <class 'NoneType'>."
cls = 'class' if sys.version_info.major > 2 else 'type'
exception = "String parameter 's' only takes a string value, not value of type <%s 'NoneType'>." % cls
with self.assertRaisesRegexp(ValueError, exception):
a.s = None # because allow_None should be False

Expand Down

0 comments on commit 25f35ba

Please sign in to comment.