Skip to content

Commit 780f3b9

Browse files
committed
Py2 compatible string types
1 parent 187f138 commit 780f3b9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/conftest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ def validator(data_json):
4040
if not found:
4141
raise ValidationError("Missing required key {}".format(k))
4242
if k in data:
43-
if v["type"] == "string" and not isinstance(data[k], str):
43+
if v["type"] == "string" and not (
44+
isinstance(data[k], str) or isinstance(data[k], basestring)
45+
):
4446
raise ValidationError(
45-
"Value {0} for key {1} should be string".format(data[k], k)
47+
"Value {0} for key {1} should be string, is {2}".format(
48+
data[k], k, type(data[k])
49+
)
4650
)
4751
if v["type"] == "datetime":
4852
try:

0 commit comments

Comments
 (0)