mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-15 20:19:23 +00:00
Improve tests
This commit is contained in:
parent
bbaac5ec1f
commit
22418a2fe0
@ -102,8 +102,7 @@ def delete(key: int) -> None:
|
||||
if TYPE_CHECKING:
|
||||
|
||||
@overload
|
||||
def get(key: int) -> bytes | None:
|
||||
...
|
||||
def get(key: int) -> bytes | None: ...
|
||||
|
||||
@overload
|
||||
def get(key: int, default: T) -> bytes | T: # noqa: F811
|
||||
|
@ -148,24 +148,19 @@ def chunks(items: Chunkable, size: int) -> Iterator[Chunkable]:
|
||||
if TYPE_CHECKING:
|
||||
|
||||
class HashContext(Protocol):
|
||||
def update(self, __buf: bytes) -> None:
|
||||
...
|
||||
def update(self, __buf: bytes) -> None: ...
|
||||
|
||||
def digest(self) -> bytes:
|
||||
...
|
||||
def digest(self) -> bytes: ...
|
||||
|
||||
class HashContextInitable(HashContext, Protocol):
|
||||
def __init__( # pylint: disable=super-init-not-called
|
||||
self, __data: bytes | None = None
|
||||
) -> None:
|
||||
...
|
||||
) -> None: ...
|
||||
|
||||
class Writer(Protocol):
|
||||
def append(self, __b: int) -> None:
|
||||
...
|
||||
def append(self, __b: int) -> None: ...
|
||||
|
||||
def extend(self, __buf: bytes) -> None:
|
||||
...
|
||||
def extend(self, __buf: bytes) -> None: ...
|
||||
|
||||
|
||||
if False: # noqa
|
||||
|
@ -78,14 +78,14 @@ class Context:
|
||||
if TYPE_CHECKING:
|
||||
|
||||
@overload
|
||||
async def read(self, expected_types: Container[int]) -> protobuf.MessageType:
|
||||
...
|
||||
async def read(
|
||||
self, expected_types: Container[int]
|
||||
) -> protobuf.MessageType: ...
|
||||
|
||||
@overload
|
||||
async def read(
|
||||
self, expected_types: Container[int], expected_type: type[LoadedMessageType]
|
||||
) -> LoadedMessageType:
|
||||
...
|
||||
) -> LoadedMessageType: ...
|
||||
|
||||
async def read(
|
||||
self,
|
||||
|
@ -230,13 +230,9 @@ class TestStorageCache(unittest.TestCase):
|
||||
self.assertEqual(cache.get(KEY), b"hello")
|
||||
|
||||
def test_EndSession(self):
|
||||
<<<<<<< HEAD
|
||||
self.assertRaises(cache.InvalidSessionError, cache.get, KEY)
|
||||
cache.start_session()
|
||||
=======
|
||||
|
||||
self.assertRaises(InvalidSessionError, cache.get, KEY)
|
||||
session_id = cache.start_session()
|
||||
>>>>>>> 8681ba167 (Basic THP functinality - not-polished prototype)
|
||||
self.assertTrue(is_session_started())
|
||||
self.assertIsNone(cache.get(KEY))
|
||||
await_result(handle_EndSession(EndSession()))
|
||||
|
Loading…
Reference in New Issue
Block a user