Skip to content

Commit

Permalink
Python 3.14 tested.
Browse files Browse the repository at this point in the history
  • Loading branch information
coady committed Nov 2, 2024
1 parent 92d861e commit baf8017
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14.0-alpha - 3.14']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ If a type implements a custom `__instancecheck__`, it can opt-in to dispatch (wi
```python
from multimethod import parametric

Coroutine = parametric(Callable, asyncio.iscoroutinefunction)
Coroutine = parametric(Callable, inspect.iscoroutinefunction)
IntArray = parametric(array, typecode='i')
```

Expand Down
5 changes: 3 additions & 2 deletions docs/examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,13 @@
"outputs": [],
"source": [
"import asyncio\n",
"import inspect\n",
"import time\n",
"from collections.abc import Callable\n",
"from concurrent import futures\n",
"from multimethod import parametric\n",
"\n",
"Coroutine = parametric(Callable, asyncio.iscoroutinefunction)\n",
"Coroutine = parametric(Callable, inspect.iscoroutinefunction)\n",
"\n",
"\n",
"@multimethod\n",
Expand Down Expand Up @@ -262,7 +263,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.3"
"version": "3.13.0"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion multimethod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_args(tp) -> tuple:


def get_mro(cls) -> tuple: # `inspect.getmro` doesn't handle all cases
return type.mro(cls) if isinstance(cls, type) else cls.mro()
return tuple(type.mro(cls)) if isinstance(cls, type) else cls.mro()


def common_bases(*bases):
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Libraries :: Python Modules",
"Typing :: Typed",
]
Expand All @@ -40,3 +41,6 @@ quote-style = "preserve"
[tool.coverage.run]
source = ["multimethod"]
branch = true

[tool.pytest.ini_options]
markers = ["benchmark"]
5 changes: 3 additions & 2 deletions tests/test_subscripts.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import inspect
import sys
import typing
import pytest
Expand Down Expand Up @@ -130,10 +131,10 @@ def test_args():

@pytest.mark.benchmark
def test_parametric():
coro = parametric(Callable, asyncio.iscoroutinefunction)
coro = parametric(Callable, inspect.iscoroutinefunction)
assert issubclass(coro, Callable)
assert not issubclass(Callable, coro)
assert not issubclass(parametric(object, asyncio.iscoroutinefunction), coro)
assert not issubclass(parametric(object, inspect.iscoroutinefunction), coro)
assert isinstance(asyncio.sleep, coro)
assert not isinstance(lambda: None, coro)
assert list(subtype.origins(coro)) == [Callable]
Expand Down

0 comments on commit baf8017

Please sign in to comment.