diff --git a/src/codex32/bip93.py b/src/codex32/bip93.py index b73a3ff..9e3757c 100644 --- a/src/codex32/bip93.py +++ b/src/codex32/bip93.py @@ -47,7 +47,11 @@ class Header: index: str def __post_init__(self) -> None: - if isinstance(self.threshold, bool) or self.threshold not in (0, *range(2, 10)): + if ( + isinstance(self.threshold, bool) + or not isinstance(self.threshold, int) + or self.threshold not in (0, *range(2, 10)) + ): raise InvalidThreshold("threshold must be 0 or an integer from 2 through 9") if not isinstance(self.identifier, str): raise InvalidIdentifier("identifier must be str") diff --git a/tests/test_public_api.py b/tests/test_public_api.py index 12f906a..09d66d4 100644 --- a/tests/test_public_api.py +++ b/tests/test_public_api.py @@ -115,6 +115,7 @@ def test_master_seed_factory_can_only_construct_index_s() -> None: ("arguments", "error"), ( ((1, "test", "s"), InvalidThreshold), + ((2.0, "test", "a"), InvalidThreshold), ((2, "bad", "a"), InvalidIdentifier), ((0, "test", "a"), InvalidShareIndex), ),