Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ coverage
flake8
pytest
pytest-cov
six>=1.4.0
PyYAML
mock; python_version < '3.3'
48 changes: 24 additions & 24 deletions test/test_functional.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os
import json
import sys
from sys import modules
import pytest
import six

try:
from unittest import mock
Expand Down Expand Up @@ -444,35 +444,35 @@ class Mytest(object):
assert getattr(getattr(ddt_mytest, 'second_test_3'), '__doc__') is None


def test_ddt_data_unicode():
@pytest.mark.skipif(sys.version_info.major > 2, reason='Python2 only test')
def test_ddt_data_unicode_py2():
"""
Test that unicode strings are converted to function names correctly
"""
# We test unicode support separately for python 2 and 3

if six.PY2:

@ddt
class Mytest(object):
@data(u'ascii', u'non-ascii-\N{SNOWMAN}', {u'\N{SNOWMAN}': 'data'})
def test_hello(self, val):
pass
@ddt
class Mytest(object):
@data(u'ascii', u'non-ascii-\N{SNOWMAN}', {u'\N{SNOWMAN}': 'data'})
def test_hello(self, val):
pass

assert getattr(Mytest, 'test_hello_1_ascii') is not None
assert getattr(Mytest, 'test_hello_2_non_ascii__u2603') is not None
assert getattr(Mytest, 'test_hello_3') is not None
assert getattr(Mytest, 'test_hello_1_ascii') is not None
assert getattr(Mytest, 'test_hello_2_non_ascii__u2603') is not None
assert getattr(Mytest, 'test_hello_3') is not None

elif six.PY3:
@pytest.mark.skipif(sys.version_info.major < 3, reason='Python3 only test')
def test_ddt_data_unicode_py3():
"""
Test that unicode strings are converted to function names correctly
"""
@ddt
class Mytest(object):
@data('ascii', 'non-ascii-\N{SNOWMAN}', {'\N{SNOWMAN}': 'data'})
def test_hello(self, val):
pass

@ddt
class Mytest(object):
@data('ascii', 'non-ascii-\N{SNOWMAN}', {'\N{SNOWMAN}': 'data'})
def test_hello(self, val):
pass

assert getattr(Mytest, 'test_hello_1_ascii') is not None
assert getattr(Mytest, 'test_hello_2_non_ascii__') is not None
assert getattr(Mytest, 'test_hello_3') is not None
assert getattr(Mytest, 'test_hello_1_ascii') is not None
assert getattr(Mytest, 'test_hello_2_non_ascii__') is not None
assert getattr(Mytest, 'test_hello_3') is not None


def test_ddt_data_object():
Expand Down
1 change: 0 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ deps =
pytest-cov
coverage
flake8
six>=1.4.0
PyYAML
commands =
pytest --cov=ddt --cov-report html
Expand Down