From c34f53e7ee787577482f9e1b67ea507299dd3be3 Mon Sep 17 00:00:00 2001 From: Ilya Etingof Date: Tue, 14 Nov 2017 11:12:09 +0100 Subject: added example code snippets to the docstrings (#101) --- pyasn1/codec/cer/encoder.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'pyasn1/codec/cer/encoder.py') diff --git a/pyasn1/codec/cer/encoder.py b/pyasn1/codec/cer/encoder.py index b4c68ec..80cdc35 100644 --- a/pyasn1/codec/cer/encoder.py +++ b/pyasn1/codec/cer/encoder.py @@ -271,6 +271,26 @@ class Encoder(encoder.Encoder): #: ------ #: :py:class:`~pyasn1.error.PyAsn1Error` #: On encoding errors +#: +#: Examples +#: -------- +#: Encode Python value into CER with ASN.1 schema +#: +#: .. code-block:: pycon +#: +#: >>> seq = SequenceOf(componentType=Integer()) +#: >>> encode([1, 2, 3], asn1Spec=seq) +#: b'0\x80\x02\x01\x01\x02\x01\x02\x02\x01\x03\x00\x00' +#: +#: Encode ASN.1 value object into CER +#: +#: .. code-block:: pycon +#: +#: >>> seq = SequenceOf(componentType=Integer()) +#: >>> seq.extend([1, 2, 3]) +#: >>> encode(seq) +#: b'0\x80\x02\x01\x01\x02\x01\x02\x02\x01\x03\x00\x00' +#: encode = Encoder(tagMap, typeMap) # EncoderFactory queries class instance and builds a map of tags -> encoders -- cgit v1.2.3