From 94896208b985fda53cc0fc2d1c634e91423bf850 Mon Sep 17 00:00:00 2001 From: Tim Rid <6593626+timrid@users.noreply.github.com> Date: Sun, 23 Oct 2022 22:24:08 +0200 Subject: [PATCH] fixed mypy error: `error: Returning Any from function declared to return "int"` --- tests/test_core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_core.py b/tests/test_core.py index 6f65772..759dbe8 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -1213,7 +1213,7 @@ def test_checksum() -> None: def test_checksum_nonbytes_issue_323() -> None: d = Struct( "vals" / Byte[2], - "checksum" / Checksum(Byte, lambda vals: sum(vals) & 0xFF, this.vals), + "checksum" / Checksum(Byte, lambda vals: int(sum(vals)) & 0xFF, this.vals), ) assert d.parse(b"\x00\x00\x00") == Container(vals=[0, 0], checksum=0) assert raises(d.parse, b"\x00\x00\x01") == ChecksumError @@ -1704,7 +1704,7 @@ def test_from_issue_324() -> None: )), "checksum" / Checksum( Byte, - lambda data: sum(data) & 0xFF, + lambda data: int(sum(data)) & 0xFF, this.vals.data ), )