Adapt tests to run on Python3
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
*.pyc
|
*.pyc
|
||||||
|
*.swp
|
||||||
build/
|
build/
|
||||||
dist/
|
dist/
|
||||||
ddt.egg-info/
|
ddt.egg-info/
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import unittest
|
import unittest
|
||||||
from ddt import ddt, data
|
from ddt import ddt, data
|
||||||
from mycode import larger_than_two
|
from .mycode import larger_than_two
|
||||||
|
|
||||||
|
|
||||||
class mylist(list):
|
class mylist(list):
|
||||||
|
|||||||
@@ -18,13 +18,13 @@ def test_data_decorator():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
pre_size = len(hello.__dict__)
|
pre_size = len(hello.__dict__)
|
||||||
keys = hello.__dict__.keys()
|
keys = set(hello.__dict__.keys())
|
||||||
data_hello = data(1, 2)(hello)
|
data_hello = data(1, 2)(hello)
|
||||||
dh_keys = data_hello.__dict__.keys()
|
dh_keys = set(data_hello.__dict__.keys())
|
||||||
post_size = len(data_hello.__dict__)
|
post_size = len(data_hello.__dict__)
|
||||||
|
|
||||||
assert_equal(post_size, pre_size + 1)
|
assert_equal(post_size, pre_size + 1)
|
||||||
extra_attrs = set(dh_keys) - set(keys)
|
extra_attrs = dh_keys - keys
|
||||||
assert_equal(len(extra_attrs), 1)
|
assert_equal(len(extra_attrs), 1)
|
||||||
extra_attr = extra_attrs.pop()
|
extra_attr = extra_attrs.pop()
|
||||||
assert_equal(getattr(data_hello, extra_attr), (1, 2))
|
assert_equal(getattr(data_hello, extra_attr), (1, 2))
|
||||||
@@ -36,7 +36,7 @@ is_test = lambda x: x.startswith('test_')
|
|||||||
def test_ddt():
|
def test_ddt():
|
||||||
"""Test the ``ddt`` class decorator"""
|
"""Test the ``ddt`` class decorator"""
|
||||||
|
|
||||||
tests = len(filter(is_test, Dummy.__dict__))
|
tests = len(list(filter(is_test, Dummy.__dict__)))
|
||||||
assert_equal(tests, 4)
|
assert_equal(tests, 4)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user