71f1854c95
Signed-off-by: Alfred Wingate <parona@protonmail.com>
69 lines
3.2 KiB
Diff
69 lines
3.2 KiB
Diff
diff --git a/src/aspectlib/__init__.py b/src/aspectlib/__init__.py
|
|
index b85f1dd..b7d0f70 100644
|
|
--- a/src/aspectlib/__init__.py
|
|
+++ b/src/aspectlib/__init__.py
|
|
@@ -18,6 +18,7 @@ from logging import getLogger
|
|
from .utils import PY2
|
|
from .utils import PY3
|
|
from .utils import PY37plus
|
|
+from .utils import PY310plus
|
|
from .utils import Sentinel
|
|
from .utils import basestring
|
|
from .utils import force_bind
|
|
diff --git a/src/aspectlib/utils.py b/src/aspectlib/utils.py
|
|
index 9e0837e..b08f2d6 100644
|
|
--- a/src/aspectlib/utils.py
|
|
+++ b/src/aspectlib/utils.py
|
|
@@ -13,6 +13,7 @@ RegexType = type(re.compile(""))
|
|
|
|
PY3 = sys.version_info[0] == 3
|
|
PY37plus = PY3 and sys.version_info[1] >= 7
|
|
+PY310plus = PY3 and sys.version_info[1] >= 10
|
|
PY2 = sys.version_info[0] == 2
|
|
PY26 = PY2 and sys.version_info[1] == 6
|
|
PYPY = platform.python_implementation() == 'PyPy'
|
|
diff --git a/tests/test_aspectlib_test.py b/tests/test_aspectlib_test.py
|
|
index 05e2c25..37fe8e8 100644
|
|
--- a/tests/test_aspectlib_test.py
|
|
+++ b/tests/test_aspectlib_test.py
|
|
@@ -4,6 +4,7 @@ from pytest import raises
|
|
from test_pkg1.test_pkg2 import test_mod
|
|
|
|
from aspectlib import PY2
|
|
+from aspectlib import PY310plus
|
|
from aspectlib.test import OrderedDict
|
|
from aspectlib.test import Story
|
|
from aspectlib.test import StoryResultWrapper
|
|
@@ -414,6 +415,7 @@ def test_story_empty_play_proxy_class():
|
|
(('stuff_1', 'mix', "'a', 'b'", ''), _Returns("(1, 2, 'a', 'b')")),
|
|
(('stuff_1', 'meth', "123", ''), _Raises(repr_ex(TypeError(
|
|
'meth() takes exactly 1 argument (2 given)' if PY2 else
|
|
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310plus else
|
|
'meth() takes 1 positional argument but 2 were given'
|
|
)))),
|
|
((None, 'test_pkg1.test_pkg2.test_mod.Stuff', "0, 1", ''), _Binds('stuff_2')),
|
|
@@ -421,6 +423,7 @@ def test_story_empty_play_proxy_class():
|
|
(('stuff_2', 'mix', "3, 4", ''), _Returns("(0, 1, 3, 4)")),
|
|
(('stuff_2', 'meth', "123", ''), _Raises(repr_ex(TypeError(
|
|
'meth() takes exactly 1 argument (2 given)' if PY2 else
|
|
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310plus else
|
|
'meth() takes 1 positional argument but 2 were given'
|
|
))))
|
|
]))
|
|
@@ -449,6 +452,7 @@ def test_story_half_play_proxy_class():
|
|
(('stuff_1', 'meth', '', ''), _Returns('None')),
|
|
(('stuff_1', 'meth', '123', ''), _Raises(repr_ex(TypeError(
|
|
'meth() takes exactly 1 argument (2 given)' if PY2 else
|
|
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310plus else
|
|
'meth() takes 1 positional argument but 2 were given'
|
|
)))),
|
|
((None, 'test_pkg1.test_pkg2.test_mod.Stuff', '0, 1', ''), _Binds("stuff_2")),
|
|
@@ -456,6 +460,7 @@ def test_story_half_play_proxy_class():
|
|
(('stuff_2', 'mix', '3, 4', ''), _Returns('(0, 1, 3, 4)')),
|
|
(('stuff_2', 'meth', '123', ''), _Raises(repr_ex(TypeError(
|
|
'meth() takes exactly 1 argument (2 given)' if PY2 else
|
|
+ 'Stuff.meth() takes 1 positional argument but 2 were given' if PY310plus else
|
|
'meth() takes 1 positional argument but 2 were given'
|
|
))))
|
|
]))
|