def test_one_enter(self, number: asn1.TNumber, typ: asn1.TType, values: Tuple, expected: bytes) -> None: encoder = Encoder() encoder.enter(number, typ) for value in values: encoder.write(value) encoder.exit() res = encoder.output() assert res == expected
def test_multiple_enter( self, values: Tuple[Tuple[asn1.TNumber, Optional[asn1.TClass], Tuple]], expected: bytes ) -> None: encoder = Encoder() for number, typ, values_ in values: encoder.enter(number, typ) for value in values_: encoder.write(value) encoder.exit() res = encoder.output() assert res == expected
def test_exit_errors(self) -> None: encoder = Encoder() with pytest.raises(Error, match="Tag stack is empty."): encoder.exit()