summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2017-11-14 11:55:22 +0100
committerIlya Etingof <etingof@gmail.com>2017-11-14 11:55:22 +0100
commit81865c1e67a33dbfcbb7a8f4ce9cfb12cc093295 (patch)
tree816eaab587cb7c0d81b952e0a1f6f33f392f3af4
parentc34f53e7ee787577482f9e1b67ea507299dd3be3 (diff)
downloadpyasn1-git-81865c1e67a33dbfcbb7a8f4ce9cfb12cc093295.tar.gz
serialization -> serialisation nitpicks
-rw-r--r--CHANGES.rst10
-rw-r--r--README.md14
-rw-r--r--docs/source/contents.rst8
-rw-r--r--docs/source/example-use-case.rst26
-rw-r--r--docs/source/pyasn1/contents.rst14
-rw-r--r--docs/source/pyasn1/type/char/bmpstring.rst2
-rw-r--r--docs/source/pyasn1/type/char/universalstring.rst2
-rw-r--r--docs/source/pyasn1/type/char/utf8string.rst2
-rw-r--r--docs/source/pyasn1/type/univ/any.rst2
-rw-r--r--docs/source/pyasn1/type/univ/sequence.rst2
-rw-r--r--docs/source/pyasn1/type/univ/sequenceof.rst2
-rw-r--r--docs/source/pyasn1/type/univ/set.rst2
-rw-r--r--docs/source/pyasn1/type/univ/setof.rst2
-rw-r--r--pyasn1/codec/cer/encoder.py2
-rw-r--r--pyasn1/type/base.py2
-rw-r--r--pyasn1/type/char.py2
-rw-r--r--pyasn1/type/namedtype.py6
-rw-r--r--pyasn1/type/univ.py14
-rw-r--r--tests/type/test_char.py14
-rw-r--r--tests/type/test_univ.py146
-rw-r--r--tests/type/test_useful.py24
21 files changed, 149 insertions, 149 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index 0a71810..968fb61 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -161,14 +161,14 @@ Revision 0.2.3, released 25-02-2017
- Improved SEQUENCE/SET/CHOICE decoding performance by maintaining a single shared
NamedType object for all instances of SEQUENCE/SET object.
- Improved INTEGER encoding/decoding by switching to Python's built-in
- integer serialization functions.
+ integer serialisation functions.
- Improved BitString performance by rebasing it onto Python int type and leveraging
- fast Integer serialization functions.
+ fast Integer serialisation functions.
- BitString type usability improved in many ways: for example bitshifting and
numeric operation on BitString is now possible.
- Minor ObjectIdentifier type performance optimization.
- ASN.1 character types refactored to keep unicode contents internally
- (rather than serialized octet stream) and duck-type it directly.
+ (rather than serialised octet stream) and duck-type it directly.
- ASN.1 OctetString initialized from a Python object performs bytes()
on it when running on Python 3 (used to do str() which is probably
less logical).
@@ -190,9 +190,9 @@ Revision 0.2.2, released 07-02-2017
-----------------------------------
- FIX TO A SECURITY WEAKNESS: define length only decoders could have successfully
- processed indefinite length serialization.
+ processed indefinite length serialisation.
- FIX TO A SECURITY WEAKNESS: canonical decoders (CER/DER) may have successfully
- consumed non-canonical variations of (otherwise valid) serialization.
+ consumed non-canonical variations of (otherwise valid) serialisation.
- Broken Enumerated subtyping fixed.
Revision 0.2.1, released 05-02-2017
diff --git a/README.md b/README.md
index f0b72b4..759cddc 100644
--- a/README.md
+++ b/README.md
@@ -26,10 +26,10 @@ Features
Why using pyasn1
----------------
-ASN.1 solves the data serialization problem. This solution was
+ASN.1 solves the data serialisation problem. This solution was
designed long ago by the wise Ancients. Back then, they did not
have the luxury of wasting bits. That is why ASN.1 is designed
-to serialize data structures of unbounded complexity into
+to serialise data structures of unbounded complexity into
something compact and efficient when it comes to processing
the data.
@@ -97,8 +97,8 @@ Record:
>>>
```
-Part of the power of ASN.1 comes from its serialization features. You
-can serialize your data structure and send it over the network.
+Part of the power of ASN.1 comes from its serialisation features. You
+can serialise your data structure and send it over the network.
```python
>>> from pyasn1.codec.der.encoder import encode
@@ -107,7 +107,7 @@ can serialize your data structure and send it over the network.
00000: 30 07 02 01 7B 80 02 01 41
```
-Conversely, you can turn serialized ASN.1 content, as received from
+Conversely, you can turn serialised ASN.1 content, as received from
network or read from a file, into a Python object which you can
introspect, modify, encode and send back.
@@ -153,9 +153,9 @@ Record:
>>>
```
-With ASN.1 design, serialization codecs are decoupled from data objects,
+With ASN.1 design, serialisation codecs are decoupled from data objects,
so you could turn every single ASN.1 object into many different
-serialized forms. As of this moment, pyasn1 supports BER, DER, CER and
+serialised forms. As of this moment, pyasn1 supports BER, DER, CER and
Python built-ins codecs. The extremely compact PER encoding is expected
to be introduced in the upcoming pyasn1 release.
diff --git a/docs/source/contents.rst b/docs/source/contents.rst
index c4582bd..2613984 100644
--- a/docs/source/contents.rst
+++ b/docs/source/contents.rst
@@ -18,10 +18,10 @@ What is ASN.1
-------------
ASN.1 is a large, arguably over-engineered and extremely old data modelling and
-serialization tool. It is probably among the first serialization protocols in
+serialisation tool. It is probably among the first serialisation protocols in
the history of computer science and technology.
-ASN.1 started its life over 30 years ago as a serialization mechanism for the first
+ASN.1 started its life over 30 years ago as a serialisation mechanism for the first
electronic mail (known as X.400). Later on if was split off the e-mail application
and become a stand-alone tech still being actively supported by its designers
and widely used in industry and technology.
@@ -30,7 +30,7 @@ Since then ASN.1 is sort of haunted by its relations with the OSI model -- the
first, unsuccessful, version of the Internet. You can read many interesting
`discussions <https://news.ycombinator.com/item?id=8871453>`_ on that topic.
-In the following years, generations of software engineers tackled the serialization
+In the following years, generations of software engineers tackled the serialisation
problem many times. We can see that in Google's `ProtoBuffers <https://developers.google.com/protocol-buffers/>`_
or `FlatBuffers <https://google.github.io/flatbuffers/>`_, for example.
Interestingly, many new takes on binary protocol design do not depart
@@ -44,7 +44,7 @@ Looking at what ASN.1 has to offer, it has three loosely coupled parts:
(integers, bits, strings, arrays and records) that can be used for describing
arbitrarily complex, nested data structures.
-* Serialization protocols: the above data structures could be converted into a
+* Serialisation protocols: the above data structures could be converted into a
series of octets for storage or transmission over the wire as well as
recovered back into their structured form. The system is fully agnostic
to hardware architectures differences.
diff --git a/docs/source/example-use-case.rst b/docs/source/example-use-case.rst
index d5be0cd..0b819c3 100644
--- a/docs/source/example-use-case.rst
+++ b/docs/source/example-use-case.rst
@@ -98,13 +98,13 @@ set on the key file):
# Read SSH key from file (assuming no passphrase)
with open open('.ssh/id_rsa') as key_file:
- b64_serialization = ''.join(key_file.readlines()[1:-1])
+ b64_serialisation = ''.join(key_file.readlines()[1:-1])
- # Undo BASE64 serialization
- der_serialization = b64decode(b64_serialization)
+ # Undo BASE64 serialisation
+ der_serialisation = b64decode(b64_serialisation)
- # Undo DER serialization, reconstruct SSH key structure
- private_key, rest_of_input = der_decoder(der_serialization, asn1Spec=RSAPrivateKey())
+ # Undo DER serialisation, reconstruct SSH key structure
+ private_key, rest_of_input = der_decoder(der_serialisation, asn1Spec=RSAPrivateKey())
Once we have Python ASN.1 structures initialized, we could inspect them:
@@ -173,21 +173,21 @@ Write it back
-------------
Possibly not that applicable to the SSH key example, but you can of course modify
-any part of the ASN.1 data structure and serialize it back into the same or other
+any part of the ASN.1 data structure and serialise it back into the same or other
wire representation:
.. code-block:: python
from pyasn1.codec.der.encoder import encode as der_encoder
- # Serialize SSH key data structure into DER stream
- der_serialization = der_encoder(private_key)
+ # Serialise SSH key data structure into DER stream
+ der_serialisation = der_encoder(private_key)
- # Serialize DER stream into BASE64 stream
- b64_serialization = '-----BEGIN RSA PRIVATE KEY-----\n'
- b64_serialization += b64encode(der_serialization)
- b64_serialization += '-----END RSA PRIVATE KEY-----\n'
+ # Serialise DER stream into BASE64 stream
+ b64_serialisation = '-----BEGIN RSA PRIVATE KEY-----\n'
+ b64_serialisation += b64encode(der_serialisation)
+ b64_serialisation += '-----END RSA PRIVATE KEY-----\n'
with open('.ssh/id_rsa.new', 'w') as key_file:
- key_file.write(b64_serialization)
+ key_file.write(b64_serialisation)
diff --git a/docs/source/pyasn1/contents.rst b/docs/source/pyasn1/contents.rst
index 57ba4b2..102ea87 100644
--- a/docs/source/pyasn1/contents.rst
+++ b/docs/source/pyasn1/contents.rst
@@ -167,7 +167,7 @@ Serialisation codecs
Common use-case for pyasn1 is to instantiate ASN.1 schema with
user-supplied values and pass instantiated schema to the encoder.
-The encoder will then turn the data structure into serialized form
+The encoder will then turn the data structure into serialised form
(stream of bytes) suitable for storing into a file or sending over
the network.
@@ -176,7 +176,7 @@ the network.
value = 1
instantiated_schema = Integer(value)
- serialized = encode(instantiated_schema)
+ serialised = encode(instantiated_schema)
Alternatively, value and schema can be passed separately:
@@ -185,24 +185,24 @@ Alternatively, value and schema can be passed separately:
value = 1
schema = Integer()
- serialized = encode(value, asn1Spec=schema)
+ serialised = encode(value, asn1Spec=schema)
At the receiving end, a decoder would be invoked and given the
-serialized data as received from the network along with the ASN.1
+serialised data as received from the network along with the ASN.1
schema describing the layout of the data structures. The outcome
would be an instance of ASN.1 schema filled with values as supplied
by the sender.
.. code-block:: python
- serialized = b'\x01\x01\x01'
+ serialised = b'\x01\x01\x01'
schema = Integer()
- value, _ = decode(serialized, asn1Spec=schema)
+ value, _ = decode(serialised, asn1Spec=schema)
assert value == 1
-Many distinct serialization protocols exist for ASN.1, some are
+Many distinct serialisation protocols exist for ASN.1, some are
implemented in pyasn1.
.. toctree::
diff --git a/docs/source/pyasn1/type/char/bmpstring.rst b/docs/source/pyasn1/type/char/bmpstring.rst
index 24040c7..066d03a 100644
--- a/docs/source/pyasn1/type/char/bmpstring.rst
+++ b/docs/source/pyasn1/type/char/bmpstring.rst
@@ -13,7 +13,7 @@
.. note::
- The |ASN.1| type models a Unicode (ISO10646-1) character string implicitly serialized into UTF-16 big endian.
+ The |ASN.1| type models a Unicode (ISO10646-1) character string implicitly serialised into UTF-16 big endian.
.. automethod:: pyasn1.type.char.BMPString.clone(value=NoValue(), tagSet=TagSet(), subtypeSpec=ConstraintsIntersection(), encoding='us-ascii')
.. automethod:: pyasn1.type.char.BMPString.subtype(value=NoValue(), implicitTag=Tag(), explicitTag=Tag(),subtypeSpec=ConstraintsIntersection(), encoding='us-ascii')
diff --git a/docs/source/pyasn1/type/char/universalstring.rst b/docs/source/pyasn1/type/char/universalstring.rst
index 5e4c8b4..3c947b8 100644
--- a/docs/source/pyasn1/type/char/universalstring.rst
+++ b/docs/source/pyasn1/type/char/universalstring.rst
@@ -13,7 +13,7 @@
.. note::
- The |ASN.1| type models a Unicode (ISO10646-1) character string implicitly serialized into UTF-32 big endian.
+ The |ASN.1| type models a Unicode (ISO10646-1) character string implicitly serialised into UTF-32 big endian.
.. automethod:: pyasn1.type.char.UniversalString.clone(value=NoValue(), tagSet=TagSet(), subtypeSpec=ConstraintsIntersection(), encoding='us-ascii')
.. automethod:: pyasn1.type.char.UniversalString.subtype(value=NoValue(), implicitTag=Tag(), explicitTag=Tag(),subtypeSpec=ConstraintsIntersection(), encoding='us-ascii')
diff --git a/docs/source/pyasn1/type/char/utf8string.rst b/docs/source/pyasn1/type/char/utf8string.rst
index 380feb7..cf3a80f 100644
--- a/docs/source/pyasn1/type/char/utf8string.rst
+++ b/docs/source/pyasn1/type/char/utf8string.rst
@@ -13,7 +13,7 @@
.. note::
- The |ASN.1| type models a Unicode (ISO10646-1) character string implicitly serialized into UTF-8.
+ The |ASN.1| type models a Unicode (ISO10646-1) character string implicitly serialised into UTF-8.
.. automethod:: pyasn1.type.char.UTF8String.clone(value=NoValue(), tagSet=TagSet(), subtypeSpec=ConstraintsIntersection(), encoding='us-ascii')
.. automethod:: pyasn1.type.char.UTF8String.subtype(value=NoValue(), implicitTag=Tag(), explicitTag=Tag(),subtypeSpec=ConstraintsIntersection(), encoding='us-ascii')
diff --git a/docs/source/pyasn1/type/univ/any.rst b/docs/source/pyasn1/type/univ/any.rst
index 6727519..e4a7876 100644
--- a/docs/source/pyasn1/type/univ/any.rst
+++ b/docs/source/pyasn1/type/univ/any.rst
@@ -16,7 +16,7 @@
The |ASN.1| type models an arbitrary value of an arbitrary type. Typically,
a selection of types are defined in form of an
`open type </pyasn1/type/opentype/contents>`_ . Technically, the ANY
- value is a serialized representation of some other ASN.1 object.
+ value is a serialised representation of some other ASN.1 object.
.. automethod:: pyasn1.type.univ.Any.clone(value=NoValue(), tagSet=TagSet(), subtypeSpec=ConstraintsIntersection(), encoding='iso-8859-1')
.. automethod:: pyasn1.type.univ.Any.subtype(value=NoValue(), implicitTag=Tag(), explicitTag=Tag(),subtypeSpec=ConstraintsIntersection(),encoding='iso-8859-1')
diff --git a/docs/source/pyasn1/type/univ/sequence.rst b/docs/source/pyasn1/type/univ/sequence.rst
index 7b0549e..6d2c6b5 100644
--- a/docs/source/pyasn1/type/univ/sequence.rst
+++ b/docs/source/pyasn1/type/univ/sequence.rst
@@ -13,7 +13,7 @@
.. note::
The |ASN.1| type models a collection of named ASN.1 components.
- Ordering of the components **is** preserved upon de/serialization.
+ Ordering of the components **is** preserved upon de/serialisation.
.. automethod:: pyasn1.type.univ.Sequence.clone(componentType=None, tagSet=tagSet(), subtypeSpec=ConstraintsIntersection())
.. automethod:: pyasn1.type.univ.Sequence.subtype(componentType=None, implicitTag=Tag(), explicitTag=Tag(),subtypeSpec=ConstraintsIntersection())
diff --git a/docs/source/pyasn1/type/univ/sequenceof.rst b/docs/source/pyasn1/type/univ/sequenceof.rst
index 52c9d50..dadef67 100644
--- a/docs/source/pyasn1/type/univ/sequenceof.rst
+++ b/docs/source/pyasn1/type/univ/sequenceof.rst
@@ -13,7 +13,7 @@
.. note::
The |ASN.1| type models a collection of elements of a single ASN.1 type.
- Ordering of the components **is** preserved upon de/serialization.
+ Ordering of the components **is** preserved upon de/serialisation.
.. automethod:: pyasn1.type.univ.SequenceOf.clone(componentType=None, tagSet=TagSet(), subtypeSpec=ConstraintsIntersection())
.. automethod:: pyasn1.type.univ.SequenceOf.subtype(componentType=None, implicitTag=Tag(), explicitTag=Tag(),subtypeSpec=ConstraintsIntersection())
diff --git a/docs/source/pyasn1/type/univ/set.rst b/docs/source/pyasn1/type/univ/set.rst
index f44d09e..5c75938 100644
--- a/docs/source/pyasn1/type/univ/set.rst
+++ b/docs/source/pyasn1/type/univ/set.rst
@@ -14,7 +14,7 @@
.. note::
The |ASN.1| type models a collection of named ASN.1 components.
- Ordering of the components **is not** preserved upon de/serialization.
+ Ordering of the components **is not** preserved upon de/serialisation.
.. automethod:: pyasn1.type.univ.Set.clone(componentType=None, tagSet=TagSet(), subtypeSpec=ConstraintsIntersection())
.. automethod:: pyasn1.type.univ.Set.subtype(componentType=None, implicitTag=Tag(), explicitTag=Tag(),subtypeSpec=ConstraintsIntersection())
diff --git a/docs/source/pyasn1/type/univ/setof.rst b/docs/source/pyasn1/type/univ/setof.rst
index a943a88..0317f4a 100644
--- a/docs/source/pyasn1/type/univ/setof.rst
+++ b/docs/source/pyasn1/type/univ/setof.rst
@@ -13,7 +13,7 @@
.. note::
The |ASN.1| type models a collection of elements of a single ASN.1 type.
- Ordering of the components **is not** preserved upon de/serialization.
+ Ordering of the components **is not** preserved upon de/serialisation.
.. automethod:: pyasn1.type.univ.SetOf.clone(componentType=None, tagSet=TagSet(), subtypeSpec=ConstraintsIntersection())
.. automethod:: pyasn1.type.univ.SetOf.subtype(componentType=None, implicitTag=Tag(), explicitTag=Tag(),subtypeSpec=ConstraintsIntersection())
diff --git a/pyasn1/codec/cer/encoder.py b/pyasn1/codec/cer/encoder.py
index 80cdc35..3f396e5 100644
--- a/pyasn1/codec/cer/encoder.py
+++ b/pyasn1/codec/cer/encoder.py
@@ -178,7 +178,7 @@ class SetOfEncoder(encoder.SequenceOfEncoder):
components = [encodeFun(x, asn1Spec, **options)
for x in value]
- # sort by serialized and padded components
+ # sort by serialised and padded components
if len(components) > 1:
zero = str2octs('\x00')
maxLen = max(map(len, components))
diff --git a/pyasn1/type/base.py b/pyasn1/type/base.py
index 45b27e3..14fd997 100644
--- a/pyasn1/type/base.py
+++ b/pyasn1/type/base.py
@@ -299,7 +299,7 @@ class AbstractSimpleAsn1Item(Asn1ItemBase):
There is an important distinction between PyASN1 schema and value objects.
The PyASN1 schema objects can only participate in ASN.1 schema-related
operations (e.g. defining or testing the structure of the data). Most
- obvious uses of ASN.1 schema is to guide serialization codecs whilst
+ obvious uses of ASN.1 schema is to guide serialisation codecs whilst
encoding/decoding serialised ASN.1 contents.
The PyASN1 value objects can **additionally** participate in many operations
diff --git a/pyasn1/type/char.py b/pyasn1/type/char.py
index 29fe7dc..78bb2e2 100644
--- a/pyasn1/type/char.py
+++ b/pyasn1/type/char.py
@@ -27,7 +27,7 @@ class AbstractCharacterString(univ.OctetString):
------------
value: :class:`unicode`, :class:`str`, :class:`bytes` or |ASN.1| object
unicode object (Python 2) or string (Python 3), alternatively string
- (Python 2) or bytes (Python 3) representing octet-stream of serialized
+ (Python 2) or bytes (Python 3) representing octet-stream of serialised
unicode string (note `encoding` parameter) or |ASN.1| class instance.
tagSet: :py:class:`~pyasn1.type.tag.TagSet`
diff --git a/pyasn1/type/namedtype.py b/pyasn1/type/namedtype.py
index bf650c8..51a830c 100644
--- a/pyasn1/type/namedtype.py
+++ b/pyasn1/type/namedtype.py
@@ -370,7 +370,7 @@ class NamedTypes(object):
def getTagMapNearPosition(self, idx):
"""Return ASN.1 types that are allowed at or past given field position.
- Some ASN.1 serialization allow for skipping optional and defaulted fields.
+ Some ASN.1 serialisation allow for skipping optional and defaulted fields.
Some constructed ASN.1 types allow reordering of the fields. When recovering
such objects it may be important to know which types can possibly be
present at any given position in the field sets.
@@ -399,7 +399,7 @@ class NamedTypes(object):
def getPositionNearType(self, tagSet, idx):
"""Return the closest field position where given ASN.1 type is allowed.
- Some ASN.1 serialization allow for skipping optional and defaulted fields.
+ Some ASN.1 serialisation allow for skipping optional and defaulted fields.
Some constructed ASN.1 types allow reordering of the fields. When recovering
such objects it may be important to know at which field position, in field set,
given *tagSet* is allowed at or past *idx* position.
@@ -449,7 +449,7 @@ class NamedTypes(object):
def minTagSet(self):
"""Return the minimal TagSet among ASN.1 type in callee *NamedTypes*.
- Some ASN.1 types/serialization protocols require ASN.1 types to be
+ Some ASN.1 types/serialisation protocols require ASN.1 types to be
arranged based on their numerical tag value. The *minTagSet* property
returns that.
diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py
index 1ff079b..3953d94 100644
--- a/pyasn1/type/univ.py
+++ b/pyasn1/type/univ.py
@@ -724,14 +724,14 @@ class OctetString(base.AbstractSimpleAsn1Item):
"""Create |ASN.1| schema or value object.
|ASN.1| objects are immutable and duck-type Python 2 :class:`str` or Python 3 :class:`bytes`.
- When used in Unicode context, |ASN.1| type assumes "|encoding|" serialization.
+ When used in Unicode context, |ASN.1| type assumes "|encoding|" serialisation.
Keyword Args
------------
value: :class:`str`, :class:`bytes` or |ASN.1| object
string (Python 2) or bytes (Python 3), alternatively unicode object
(Python 2) or string (Python 3) representing character string to be
- serialized into octets (note `encoding` parameter) or |ASN.1| object.
+ serialised into octets (note `encoding` parameter) or |ASN.1| object.
tagSet: :py:class:`~pyasn1.type.tag.TagSet`
Object representing non-default ASN.1 tag(s)
@@ -1883,7 +1883,7 @@ class SequenceOfAndSetOfBase(base.AbstractConstructedAsn1Item):
There is an important distinction between PyASN1 schema and value objects.
The PyASN1 schema objects can only participate in ASN.1 schema-related
operations (e.g. defining or testing the structure of the data). Most
- obvious uses of ASN.1 schema is to guide serialization codecs whilst
+ obvious uses of ASN.1 schema is to guide serialisation codecs whilst
encoding/decoding serialised ASN.1 contents.
The PyASN1 value objects can **additionally** participate in many operations
@@ -2382,7 +2382,7 @@ class SequenceAndSetBase(base.AbstractConstructedAsn1Item):
There is an important distinction between PyASN1 schema and value objects.
The PyASN1 schema objects can only participate in ASN.1 schema-related
operations (e.g. defining or testing the structure of the data). Most
- obvious uses of ASN.1 schema is to guide serialization codecs whilst
+ obvious uses of ASN.1 schema is to guide serialisation codecs whilst
encoding/decoding serialised ASN.1 contents.
The PyASN1 value objects can **additionally** participate in many operations
@@ -2894,7 +2894,7 @@ class Choice(Set):
There is an important distinction between PyASN1 schema and value objects.
The PyASN1 schema objects can only participate in ASN.1 schema-related
operations (e.g. defining or testing the structure of the data). Most
- obvious uses of ASN.1 schema is to guide serialization codecs whilst
+ obvious uses of ASN.1 schema is to guide serialisation codecs whilst
encoding/decoding serialised ASN.1 contents.
The PyASN1 value objects can **additionally** participate in many operations
@@ -2920,14 +2920,14 @@ class Any(OctetString):
|ASN.1| objects are immutable and duck-type Python 2 :class:`str` or Python 3
:class:`bytes`. When used in Unicode context, |ASN.1| type assumes "|encoding|"
- serialization.
+ serialisation.
Keyword Args
------------
value: :class:`str`, :class:`bytes` or |ASN.1| object
string (Python 2) or bytes (Python 3), alternatively unicode object
(Python 2) or string (Python 3) representing character string to be
- serialized into octets (note `encoding` parameter) or |ASN.1| object.
+ serialised into octets (note `encoding` parameter) or |ASN.1| object.
tagSet: :py:class:`~pyasn1.type.tag.TagSet`
Object representing non-default ASN.1 tag(s)
diff --git a/tests/type/test_char.py b/tests/type/test_char.py
index 1301a50..17d6077 100644
--- a/tests/type/test_char.py
+++ b/tests/type/test_char.py
@@ -52,7 +52,7 @@ class AbstractStringTestCase(object):
except PyAsn1Error:
assert False, 'Size constraint failed'
- def testSerialized(self):
+ def testSerialised(self):
if sys.version_info[0] < 3:
assert str(self.asn1String) == self.pythonString.encode(self.encoding), '__str__() fails'
else:
@@ -114,17 +114,17 @@ class AbstractStringTestCase(object):
def testSchemaPickling(self):
old_asn1 = self.asn1Type()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == self.asn1Type
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = self.asn1String
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1 == self.asn1String
diff --git a/tests/type/test_univ.py b/tests/type/test_univ.py
index 36a3fd4..b2fdf5b 100644
--- a/tests/type/test_univ.py
+++ b/tests/type/test_univ.py
@@ -301,17 +301,17 @@ class IntegerPicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = univ.Integer()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.Integer
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = univ.Integer(-123)
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1 == -123
@@ -351,17 +351,17 @@ class BooleanPicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = univ.Boolean()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.Boolean
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = univ.Boolean(True)
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1 == True
@@ -448,17 +448,17 @@ class BitStringPicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = univ.BitString()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.BitString
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = univ.BitString((1, 0, 1, 0))
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1 == (1, 0, 1, 0)
@@ -479,7 +479,7 @@ class OctetStringWithUnicodeMixIn(object):
assert univ.OctetString(univ.OctetString(self.encodedPythonString)) == self.encodedPythonString
assert univ.OctetString(univ.Integer(123)) == univ.OctetString('123')
- def testSerialized(self):
+ def testSerialised(self):
if sys.version_info[0] < 3:
assert str(univ.OctetString(self.encodedPythonString, encoding=self.encoding)) == self.encodedPythonString, '__str__() fails'
else:
@@ -604,17 +604,17 @@ class OctetStringPicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = univ.BitString()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.BitString
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = univ.BitString((1, 0, 1, 0))
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1 == (1, 0, 1, 0)
@@ -671,17 +671,17 @@ class NullPicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = univ.Null()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.Null
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = univ.Null('')
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert not new_asn1
@@ -822,17 +822,17 @@ class RealPicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = univ.Real()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.Real
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = univ.Real((1, 10, 3))
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1 == 1000
@@ -900,17 +900,17 @@ class ObjectIdentifierPicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = univ.ObjectIdentifier()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.ObjectIdentifier
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = univ.ObjectIdentifier('2.3.1.1.2')
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1 == (2, 3, 1, 1, 2)
@@ -1158,18 +1158,18 @@ class SequenceOfPicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = univ.SequenceOf(componentType=univ.OctetString())
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.SequenceOf
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = univ.SequenceOf(componentType=univ.OctetString())
old_asn1[0] = 'test'
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1
assert new_asn1 == [str2octs('test')]
@@ -1484,9 +1484,9 @@ class SequencePicklingTestCase(unittest.TestCase):
namedtype.NamedType('name', univ.OctetString())
)
)
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.Sequence
assert old_asn1.isSameTypeWith(new_asn1)
@@ -1497,9 +1497,9 @@ class SequencePicklingTestCase(unittest.TestCase):
)
)
old_asn1['name'] = 'test'
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1
assert new_asn1['name'] == str2octs('test')
@@ -1537,18 +1537,18 @@ class SetOfPicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = univ.SetOf(componentType=univ.OctetString())
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.SetOf
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = univ.SetOf(componentType=univ.OctetString())
old_asn1[0] = 'test'
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1
assert new_asn1 == [str2octs('test')]
@@ -1647,9 +1647,9 @@ class SetPicklingTestCase(unittest.TestCase):
namedtype.NamedType('name', univ.OctetString())
)
)
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.Set
assert old_asn1.isSameTypeWith(new_asn1)
@@ -1660,9 +1660,9 @@ class SetPicklingTestCase(unittest.TestCase):
)
)
old_asn1['name'] = 'test'
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1
assert new_asn1['name'] == str2octs('test')
@@ -1823,9 +1823,9 @@ class ChoicePicklingTestCase(unittest.TestCase):
namedtype.NamedType('id', univ.Integer())
)
)
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == univ.Choice
assert old_asn1.isSameTypeWith(new_asn1)
@@ -1837,9 +1837,9 @@ class ChoicePicklingTestCase(unittest.TestCase):
)
)
old_asn1['name'] = 'test'
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1
assert new_asn1['name'] == str2octs('test')
diff --git a/tests/type/test_useful.py b/tests/type/test_useful.py
index 2af17ff..b9322dc 100644
--- a/tests/type/test_useful.py
+++ b/tests/type/test_useful.py
@@ -83,17 +83,17 @@ class GeneralizedTimePicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = useful.GeneralizedTime()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == useful.GeneralizedTime
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = useful.GeneralizedTime("20170916234254+0130")
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1 == old_asn1
@@ -122,17 +122,17 @@ class UTCTimePicklingTestCase(unittest.TestCase):
def testSchemaPickling(self):
old_asn1 = useful.UTCTime()
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert type(new_asn1) == useful.UTCTime
assert old_asn1.isSameTypeWith(new_asn1)
def testValuePickling(self):
old_asn1 = useful.UTCTime("170711000102")
- serialized = pickle.dumps(old_asn1)
- assert serialized
- new_asn1 = pickle.loads(serialized)
+ serialised = pickle.dumps(old_asn1)
+ assert serialised
+ new_asn1 = pickle.loads(serialised)
assert new_asn1 == old_asn1