diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2019-10-17 19:07:18 +0300 |
---|---|---|
committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2019-10-17 20:03:36 +0300 |
commit | f436fe8e72e3e58b7957821b8be24af040fb8bbc (patch) | |
tree | b8afb465796cc02aba26020b52d8306532233144 /tests | |
parent | fe987a283d2bc96ea126861a220eb424182436b0 (diff) | |
download | apscheduler-f436fe8e72e3e58b7957821b8be24af040fb8bbc.tar.gz |
Adapted the code for the 3.x branch
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_util.py | 23 | ||||
-rw-r--r-- | tests/test_util_py35.py | 22 |
2 files changed, 23 insertions, 22 deletions
diff --git a/tests/test_util.py b/tests/test_util.py index 30ce06d..f1f07e6 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -13,9 +13,7 @@ from apscheduler.job import Job from apscheduler.util import ( asint, asbool, astimezone, convert_to_datetime, datetime_to_utc_timestamp, utc_timestamp_to_datetime, timedelta_seconds, datetime_ceil, get_callable_name, obj_to_ref, - ref_to_obj, maybe_ref, check_callable_args, datetime_repr, repr_escape, - iscoroutinefunction_partial -) + ref_to_obj, maybe_ref, check_callable_args, datetime_repr, repr_escape) from tests.conftest import minpython, maxpython try: @@ -357,22 +355,3 @@ class TestCheckCallableArgs(object): exc = pytest.raises(ValueError, check_callable_args, func, [1], {}) assert str(exc.value) == ('The following keyword-only arguments have not been supplied in ' 'kwargs: y') - - -class TestIsCoroutineFunctionPartial(object): - @staticmethod - def not_a_coro(x): - pass - - @staticmethod - async def a_coro(x): - pass - - def test_non_coro(self): - assert not iscoroutinefunction_partial(self.not_a_coro) - - def test_coro(self): - assert iscoroutinefunction_partial(self.a_coro) - - def test_coro_partial(self): - assert iscoroutinefunction_partial(partial(self.a_coro, 1)) diff --git a/tests/test_util_py35.py b/tests/test_util_py35.py new file mode 100644 index 0000000..e3d35cd --- /dev/null +++ b/tests/test_util_py35.py @@ -0,0 +1,22 @@ +from functools import partial + +from apscheduler.util import iscoroutinefunction_partial + + +class TestIsCoroutineFunctionPartial: + @staticmethod + def not_a_coro(x): + pass + + @staticmethod + async def a_coro(x): + pass + + def test_non_coro(self): + assert not iscoroutinefunction_partial(self.not_a_coro) + + def test_coro(self): + assert iscoroutinefunction_partial(self.a_coro) + + def test_coro_partial(self): + assert iscoroutinefunction_partial(partial(self.a_coro, 1)) |