Skip to content

Commit

Permalink
Merge 3753c94 into 7dccb19
Browse files Browse the repository at this point in the history
  • Loading branch information
foutrelis committed Dec 8, 2021
2 parents 7dccb19 + 3753c94 commit d7f6004
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/aspectlib/utils.py
Expand Up @@ -13,6 +13,7 @@

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'
Expand Down
16 changes: 11 additions & 5 deletions tests/test_aspectlib_test.py
Expand Up @@ -3,7 +3,6 @@
from pytest import raises
from test_pkg1.test_pkg2 import test_mod

from aspectlib import PY2
from aspectlib.test import OrderedDict
from aspectlib.test import Story
from aspectlib.test import StoryResultWrapper
Expand All @@ -13,7 +12,9 @@
from aspectlib.test import _Returns
from aspectlib.test import mock
from aspectlib.test import record
from aspectlib.utils import PY2
from aspectlib.utils import PY26
from aspectlib.utils import PY310plus
from aspectlib.utils import repr_ex

pytest_plugins = 'pytester',
Expand Down Expand Up @@ -414,14 +415,17 @@ 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
'meth() takes 1 positional argument but 2 were given'
('Stuff.' 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')),
(('stuff_2', 'mix', "'a', 'b'", ''), _Returns("(0, 1, 'a', 'b')")),
(('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
'meth() takes 1 positional argument but 2 were given'
('Stuff.' if PY310plus else '') +
'meth() takes 1 positional argument but 2 were given'
))))
]))

Expand Down Expand Up @@ -449,14 +453,16 @@ 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
'meth() takes 1 positional argument but 2 were given'
('Stuff.' 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")),
(('stuff_2', 'mix', "'a', 'b'", ''), _Returns("(0, 1, 'a', 'b')")),
(('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
'meth() takes 1 positional argument but 2 were given'
('Stuff.' if PY310plus else '') +
'meth() takes 1 positional argument but 2 were given'
))))
]))

Expand Down

0 comments on commit d7f6004

Please sign in to comment.