Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rwgk committed Feb 1, 2024
1 parent 0b818ac commit b2b6663
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_methods_and_attributes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import abc
import sys

import pytest
Expand Down Expand Up @@ -227,6 +228,22 @@ def test_metaclass_override():
assert isinstance(m.MetaclassOverride.__dict__["readonly"], int)


def test_abc_meta_incompatibility(): # Mostly to clearly expose the behavior.
with pytest.raises(TypeError) as exc_info:

class ExampleMandAABC(m.ExampleMandA, metaclass=abc.ABCMeta):
pass

assert "metaclass conflict" in str(exc_info.value)


def test_abc_meta_compatibility():
class MetaclassOverrideABC(m.MetaclassOverride, metaclass=abc.ABCMeta):
pass

assert type(MetaclassOverrideABC).__name__ == "ABCMeta"


def test_no_mixed_overloads():
from pybind11_tests import detailed_error_messages_enabled

Expand Down

0 comments on commit b2b6663

Please sign in to comment.