with self.assertRaises(TagMismatch):
obj.decode(int_encoded)
+ def test_tag_mismatch_underlying(self):
+ class SeqOfBoolean(SequenceOf):
+ schema = Boolean()
+
+ class SeqOfInteger(SequenceOf):
+ schema = Integer()
+
+ class Wahl(Choice):
+ schema = (
+ ("erste", SeqOfBoolean()),
+ )
+
+ int_encoded = SeqOfInteger((Integer(123),)).encode()
+ bool_encoded = SeqOfBoolean((Boolean(False),)).encode()
+ obj = Wahl()
+ obj.decode(bool_encoded)
+ with self.assertRaises(TagMismatch) as err:
+ obj.decode(int_encoded)
+ self.assertEqual(err.exception.decode_path, ("erste", "0"))
+
@composite
def seq_values_strategy(draw, seq_klass, do_expl=False):