diff options
Diffstat (limited to 'tests/test_interfaces.py')
-rw-r--r-- | tests/test_interfaces.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/test_interfaces.py b/tests/test_interfaces.py index bdb4a94d..97df45a3 100644 --- a/tests/test_interfaces.py +++ b/tests/test_interfaces.py @@ -8,7 +8,33 @@ import pytest import six -from cryptography.utils import InterfaceNotImplemented, verify_interface +from cryptography.utils import ( + InterfaceNotImplemented, register_interface_if, verify_interface +) + + +def test_register_interface_if_true(): + @six.add_metaclass(abc.ABCMeta) + class SimpleInterface(object): + pass + + @register_interface_if(1 == 1, SimpleInterface) + class SimpleClass(object): + pass + + assert issubclass(SimpleClass, SimpleInterface) is True + + +def test_register_interface_if_false(): + @six.add_metaclass(abc.ABCMeta) + class SimpleInterface(object): + pass + + @register_interface_if(1 == 2, SimpleInterface) + class SimpleClass(object): + pass + + assert issubclass(SimpleClass, SimpleInterface) is False class TestVerifyInterface(object): |