aboutsummaryrefslogtreecommitdiff
path: root/pyasn1/codec/cer/encoder.py
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-11-14 11:12:09 +0100
committerGitHub <noreply@github.com>2017-11-14 11:12:09 +0100
commitc34f53e7ee787577482f9e1b67ea507299dd3be3 (patch)
tree1aa1420059f55f824ed4a6ea812386be426ed63f /pyasn1/codec/cer/encoder.py
parentdc865c255eed64d222cab8bcb9d15e08cc74e2c9 (diff)
downloadpyasn1-c34f53e7ee787577482f9e1b67ea507299dd3be3.tar.gz
added example code snippets to the docstrings (#101)
Diffstat (limited to 'pyasn1/codec/cer/encoder.py')
-rw-r--r--pyasn1/codec/cer/encoder.py20
1 files changed, 20 insertions, 0 deletions
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