mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
Delete unused register_interface_if (#5883)
This commit is contained in:
parent
245d15b563
commit
17ec5db337
2 changed files with 0 additions and 33 deletions
|
|
@ -49,16 +49,6 @@ def register_interface(iface):
|
|||
return register_decorator
|
||||
|
||||
|
||||
def register_interface_if(predicate, iface):
|
||||
def register_decorator(klass, *, check_annotations=False):
|
||||
if predicate:
|
||||
verify_interface(iface, klass, check_annotations=check_annotations)
|
||||
iface.register(klass)
|
||||
return klass
|
||||
|
||||
return register_decorator
|
||||
|
||||
|
||||
def int_to_bytes(integer: int, length: typing.Optional[int] = None) -> bytes:
|
||||
return integer.to_bytes(
|
||||
length or (integer.bit_length() + 7) // 8 or 1, "big"
|
||||
|
|
|
|||
|
|
@ -8,33 +8,10 @@ import pytest
|
|||
|
||||
from cryptography.utils import (
|
||||
InterfaceNotImplemented,
|
||||
register_interface_if,
|
||||
verify_interface,
|
||||
)
|
||||
|
||||
|
||||
def test_register_interface_if_true():
|
||||
class SimpleInterface(metaclass=abc.ABCMeta):
|
||||
pass
|
||||
|
||||
@register_interface_if(1 == 1, SimpleInterface)
|
||||
class SimpleClass(object):
|
||||
pass
|
||||
|
||||
assert issubclass(SimpleClass, SimpleInterface) is True
|
||||
|
||||
|
||||
def test_register_interface_if_false():
|
||||
class SimpleInterface(metaclass=abc.ABCMeta):
|
||||
pass
|
||||
|
||||
@register_interface_if(1 == 2, SimpleInterface)
|
||||
class SimpleClass(object):
|
||||
pass
|
||||
|
||||
assert issubclass(SimpleClass, SimpleInterface) is False
|
||||
|
||||
|
||||
class TestVerifyInterface(object):
|
||||
def test_verify_missing_method(self):
|
||||
class SimpleInterface(metaclass=abc.ABCMeta):
|
||||
|
|
|
|||
Loading…
Reference in a new issue