autobahn.wamp.test.test_wamp_serializer


Module Contents

Classes

TestFlatBuffersSerializer

A class whose instances are single test cases.

TestDecimalSerializer

binary fixed-point

TestSerializer

A class whose instances are single test cases.

Functions

generate_test_messages()

List of WAMP test message used for serializers. Expand this if you add more

generate_test_messages_binary()

Generate WAMP test messages which contain binary app payloads.

create_serializers([decimal_support])

autobahn.wamp.test.test_wamp_serializer.generate_test_messages()[source]

List of WAMP test message used for serializers. Expand this if you add more options or messages.

This list of WAMP message does not contain any binary app payloads!

autobahn.wamp.test.test_wamp_serializer.generate_test_messages_binary()[source]

Generate WAMP test messages which contain binary app payloads.

With the JSON serializer, this currently only works on Python 3 (both CPython3 and PyPy3), because even on Python 3, we need to patch the stdlib JSON, and on Python 2, the patching would be even hackier.

autobahn.wamp.test.test_wamp_serializer.create_serializers(decimal_support=False)[source]
class autobahn.wamp.test.test_wamp_serializer.TestFlatBuffersSerializer(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

test_basic()[source]
class autobahn.wamp.test.test_wamp_serializer.TestDecimalSerializer(methodName='runTest')[source]

Bases: unittest.TestCase

binary fixed-point binary floating-point: float (float32), double (float64) decimal floating-point: decimal128, decimal256 decimal fixed-point: NUMERIC(precision, scale) decimal arbitrary precision: NUMERIC, decimal.Decimal

https://developer.nvidia.com/blog/implementing-high-precision-decimal-arithmetic-with-cuda-int128/ https://github.com/johnmcfarlane/cnl

setUp() None[source]

Hook method for setting up the test fixture before exercising it.

test_json_no_decimal()[source]

Test without use_decimal_from_str feature of JSON object serializer.

test_json_decimal()[source]

Test use_decimal_from_str feature of JSON object serializer.

test_roundtrip_msg()[source]
test_crosstrip_msg()[source]
class autobahn.wamp.test.test_wamp_serializer.TestSerializer(methodName='runTest')[source]

Bases: unittest.TestCase

A class whose instances are single test cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run.

When subclassing TestCase, you can set these attributes: * failureException: determines which exception will be raised when

the instance’s assertion methods fail; test methods raising this exception will be deemed to have ‘failed’ rather than ‘errored’.

  • longMessage: determines whether long messages (including repr of

    objects used in assert methods) will be printed on failure in addition to any explicit message passed.

  • maxDiff: sets the maximum length of a diff in failure messages

    by assert methods using difflib. It is looked up as an instance attribute so can be configured by individual tests if required.

setUp()[source]

Hook method for setting up the test fixture before exercising it.

test_deep_equal_msg()[source]

Test deep object equality assert (because I am paranoid).

test_roundtrip_msg()[source]

Test round-tripping over each serializer.

test_crosstrip_msg()[source]

Test cross-tripping over 2 serializers (as is done by WAMP routers).

test_cache_msg()[source]

Test message serialization caching.

test_initial_stats()[source]

Test initial serializer stats are indeed empty.

test_serialize_stats()[source]

Test serializer stats are non-empty after serializing/unserializing messages.

test_serialize_stats_with_details()[source]

Test serializer stats - with details - are non-empty after serializing/unserializing messages.

test_reset_stats()[source]

Test serializer stats are reset after fetching stats - depending on option.

test_auto_stats()[source]

Test serializer stats are non-empty after serializing/unserializing messages.