+ def text_alphabet(self):
+ return digits
+
+ @given(text(alphabet=ascii_letters, min_size=1, max_size=5))
+ def test_non_numeric(self, cyrillic_text):
+ with assertRaisesRegex(self, DecodeError, "non-numeric"):
+ self.base_klass(cyrillic_text)
+
+ @given(
+ sets(integers(min_value=0, max_value=10), min_size=2, max_size=2),
+ integers(min_value=0),
+ lists(integers()),
+ )
+ def test_invalid_bounds_while_decoding(self, ints, offset, decode_path):
+ decode_path = tuple(str(i) for i in decode_path)
+ value, bound_min = list(sorted(ints))
+
+ class String(self.base_klass):
+ bounds = (bound_min, bound_min)
+ with self.assertRaises(DecodeError) as err:
+ String().decode(
+ self.base_klass(b"1" * value).encode(),
+ offset=offset,
+ decode_path=decode_path,
+ )
+ repr(err.exception)
+ self.assertEqual(err.exception.offset, offset)
+ self.assertEqual(err.exception.decode_path, decode_path)
+