Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pamqp for openSUSE:Factory checked in at 2022-10-06 07:42:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pamqp (Old) and /work/SRC/openSUSE:Factory/.python-pamqp.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pamqp" Thu Oct 6 07:42:03 2022 rev:9 rq:1008146 version:3.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pamqp/python-pamqp.changes 2021-02-23 20:23:31.707821397 +0100 +++ /work/SRC/openSUSE:Factory/.python-pamqp.new.2275/python-pamqp.changes 2022-10-06 07:42:13.656690446 +0200 @@ -1,0 +2,11 @@ +Tue Oct 4 22:06:53 UTC 2022 - Yogalakshmi Arunachalam <[email protected]> + +- Update to 3.2.0 (2022-06-27) + * Allow long-str to fall back to bytes in case of UnicodeDecodeError (AMQP 1.0 interop) (#40 - dmaone) + * DOMAIN_REGEX enhanced to fulfill tag uri scheme for exchange and queue names. (#42 - deschmih) + +- Update to 3.1.0 (2022-01-10) + * Add implicit UTC timezone behavior to the AMQP Basic.Properties timestamp value. (#37 - RemiCardona) + * Add support for short-short-int and short-short-uint. (#33 - michal800106) + +------------------------------------------------------------------- Old: ---- pamqp-3.0.1.tar.gz New: ---- pamqp-3.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pamqp.spec ++++++ --- /var/tmp/diff_new_pack.goRuVn/_old 2022-10-06 07:42:14.832693064 +0200 +++ /var/tmp/diff_new_pack.goRuVn/_new 2022-10-06 07:42:14.840693082 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-pamqp # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define skip_python2 1 Name: python-pamqp -Version: 3.0.1 +Version: 3.2.0 Release: 0 Summary: Pure-python AMQP 0-9-1 frame encoder and decoder License: BSD-3-Clause ++++++ pamqp-3.0.1.tar.gz -> pamqp-3.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/.github/workflows/deploy.yaml new/pamqp-3.2.0/.github/workflows/deploy.yaml --- old/pamqp-3.0.1/.github/workflows/deploy.yaml 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/.github/workflows/deploy.yaml 2022-06-27 16:39:36.000000000 +0200 @@ -7,7 +7,7 @@ deploy: runs-on: ubuntu-latest if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'gmr/pamqp' - container: python:3.8-alpine + container: python:3.10-alpine steps: - name: Checkout repository uses: actions/checkout@v1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/.github/workflows/testing.yaml new/pamqp-3.2.0/.github/workflows/testing.yaml --- old/pamqp-3.0.1/.github/workflows/testing.yaml 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/.github/workflows/testing.yaml 2022-06-27 16:39:36.000000000 +0200 @@ -12,7 +12,11 @@ runs-on: ubuntu-latest strategy: matrix: - python: [3.6, 3.7, 3.8] + python: + - "3.7" + - "3.8" + - "3.9" + - "3.10" container: image: python:${{ matrix.python }}-alpine steps: @@ -26,10 +30,7 @@ run: setup-timezone -z America/New_York - name: Install testing dependencies - run: pip3 install -e '.[test]' - - - name: Install library dependencies - run: python3 setup.py develop + run: pip3 install -e '.[testing]' - name: Create build directory run: mkdir build @@ -38,7 +39,7 @@ run: flake8 --output build/flake8.txt --tee - name: Run tests - run: nosetests + run: coverage run && coverage report && coverage xml - name: Upload Coverage uses: codecov/[email protected] @@ -47,4 +48,3 @@ token: ${{secrets.CODECOV_TOKEN}} file: build/coverage.xml flags: unittests - fail_ci_if_error: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/CONTRIBUTING.md new/pamqp-3.2.0/CONTRIBUTING.md --- old/pamqp-3.0.1/CONTRIBUTING.md 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/CONTRIBUTING.md 2022-06-27 16:39:36.000000000 +0200 @@ -2,19 +2,19 @@ To get setup in the environment and run the tests, take the following steps: -```bash -virtualenv -p python3 env +```sh +python3 -m venv env source env/bin/activate -pip install -r requirements.txt +pip install -e '.[testing]' -nosetests flake8 +coverage run && coverage report ``` Please format your code contributions with the ``yapf`` formatter: -```bash -yapf -i --style=pep8 pamqp +```sh +yapf -i --recursive --style=pep8 pamqp ``` ## Test Coverage diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/LICENSE new/pamqp-3.2.0/LICENSE --- old/pamqp-3.0.1/LICENSE 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/LICENSE 2022-06-27 16:39:36.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright (c) 2011-2020 Gavin M. Roy +Copyright (c) 2011-2022 Gavin M. Roy All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/README.rst new/pamqp-3.2.0/README.rst --- old/pamqp-3.0.1/README.rst 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/README.rst 2022-06-27 16:39:36.000000000 +0200 @@ -13,11 +13,11 @@ Python Versions Supported ------------------------- -3.6+ +3.7+ License ------- -Copyright (c) 2011-2020 Gavin M. Roy +Copyright (c) 2011-2022 Gavin M. Roy All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/docs/changelog.rst new/pamqp-3.2.0/docs/changelog.rst --- old/pamqp-3.0.1/docs/changelog.rst 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/docs/changelog.rst 2022-06-27 16:39:36.000000000 +0200 @@ -1,6 +1,16 @@ Changelog ========= +3.2.0 (2022-06-27) +------------------ +- Allow long-str to fall back to bytes in case of UnicodeDecodeError (AMQP 1.0 interop) (#40 - `dmaone <https://github.com/dmaone>`_) +- DOMAIN_REGEX enhanced to fulfill tag uri scheme for exchange and queue names. (#42 - `deschmih <https://github.com/deschmih>`_) + +3.1.0 (2022-01-10) +------------------ +- Add implicit UTC timezone behavior to the AMQP Basic.Properties timestamp value. (#37 - `RemiCardona <https://github.com/RemiCardona>`_) +- Add support for short-short-int and short-short-uint. (#33 - `michal800106 <https://github.com/michal800106>`_) + 3.0.1 (2020-08-07) ------------------ - Fix an issue with `Basic.Reject` `requeue=False` always being set to `True` (#29 - `eandersson <https://github.com/eandersson>`_) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/docs/index.rst new/pamqp-3.2.0/docs/index.rst --- old/pamqp-3.0.1/docs/index.rst 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/docs/index.rst 2022-06-27 16:39:36.000000000 +0200 @@ -40,7 +40,7 @@ License ------- -Copyright (c) 2011-2020 Gavin M. Roy +Copyright (c) 2011-2022 Gavin M. Roy All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/pamqp/__init__.py new/pamqp-3.2.0/pamqp/__init__.py --- old/pamqp-3.0.1/pamqp/__init__.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/pamqp/__init__.py 2022-06-27 16:39:36.000000000 +0200 @@ -3,7 +3,7 @@ __author__ = 'Gavin M. Roy' __email__ = '[email protected]' __since__ = '2011-09-23' -__version__ = '3.0.1' +__version__ = version = '3.2.0' __all__ = [ 'body', 'decode', 'commands', 'constants', 'encode', 'exceptions', 'frame', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/pamqp/base.py new/pamqp-3.2.0/pamqp/base.py --- old/pamqp-3.0.1/pamqp/base.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/pamqp/base.py 2022-06-27 16:39:36.000000000 +0200 @@ -147,8 +147,9 @@ def __eq__(self, other: object) -> bool: if not isinstance(other, BasicProperties): raise NotImplementedError - return all(getattr(self, k, None) == getattr(other, k, None) - for k in self.__slots__) + return all( + getattr(self, k, None) == getattr(other, k, None) + for k in self.__slots__) def encode_property(self, name: str, value: common.FieldValue) -> bytes: """Encode a single property value @@ -208,5 +209,5 @@ if self.cluster_id != '': raise ValueError('cluster_id must be empty') if self.delivery_mode is not None and self.delivery_mode not in [1, 2]: - raise ValueError( - 'Invalid delivery_mode value: {}'.format(self.delivery_mode)) + raise ValueError('Invalid delivery_mode value: {}'.format( + self.delivery_mode)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/pamqp/common.py new/pamqp-3.2.0/pamqp/common.py --- old/pamqp-3.0.1/pamqp/common.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/pamqp/common.py 2022-06-27 16:39:36.000000000 +0200 @@ -36,16 +36,8 @@ """ -FieldValue = typing.Union[bool, - bytearray, - decimal.Decimal, - FieldArray, - FieldTable, - float, - int, - None, - str, - datetime.datetime] +FieldValue = typing.Union[bool, bytes, bytearray, decimal.Decimal, FieldArray, + FieldTable, float, int, None, str, datetime.datetime] """Defines valid field values for a :const:`FieldTable` and a :const:`FieldValue` @@ -64,11 +56,12 @@ double = struct.Struct('>d') float = struct.Struct('>f') integer = struct.Struct('>I') - long = struct.Struct('>l') + uint = struct.Struct('>i') long_long_int = struct.Struct('>q') - short = struct.Struct('>h') - short_short = struct.Struct('>B') + short_short_int = struct.Struct('>b') + short_short_uint = struct.Struct('>B') timestamp = struct.Struct('>Q') - uint = struct.Struct('>i') + long = struct.Struct('>l') ulong = struct.Struct('>L') + short = struct.Struct('>h') ushort = struct.Struct('>H') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/pamqp/constants.py new/pamqp-3.2.0/pamqp/constants.py --- old/pamqp-3.0.1/pamqp/constants.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/pamqp/constants.py 2022-06-27 16:39:36.000000000 +0200 @@ -71,8 +71,8 @@ # AMQP domain patterns DOMAIN_REGEX = { - 'exchange-name': re.compile(r'^[a-zA-Z0-9-_.:]*$'), - 'queue-name': re.compile(r'^[a-zA-Z0-9-_.:]*$') + 'exchange-name': re.compile(r'^[a-zA-Z0-9-_.:@#,/]*$'), + 'queue-name': re.compile(r'^[a-zA-Z0-9-_.:@#,/]*$') } # Other constants diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/pamqp/decode.py new/pamqp-3.2.0/pamqp/decode.py --- old/pamqp-3.0.1/pamqp/decode.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/pamqp/decode.py 2022-06-27 16:39:36.000000000 +0200 @@ -5,7 +5,6 @@ """ import datetime import decimal as _decimal -import time import typing from pamqp import common @@ -164,7 +163,7 @@ raise ValueError('Could not unpack long-long integer value') -def long_str(value: bytes) -> typing.Tuple[int, str]: +def long_str(value: bytes) -> typing.Tuple[int, typing.Union[str, bytes]]: """Decode a string value, returning bytes consumed and the value. :param value: The binary value to decode @@ -177,6 +176,8 @@ return length + 4, value[4:length + 4].decode('utf-8') except TypeError: raise ValueError('Could not unpack long string value') + except UnicodeDecodeError: + return length + 4, value[4:length + 4] def octet(value: bytes) -> typing.Tuple[int, int]: @@ -232,11 +233,26 @@ """ try: - return 1, common.Struct.short_short.unpack_from(value[0:1])[0] + return 1, common.Struct.short_short_int.unpack_from(value[0:1])[0] except TypeError: raise ValueError('Could not unpack short-short integer value') +def short_short_uint(value: bytes) -> typing.Tuple[int, int]: + """Decode a unsigned short-short integer value, returning bytes consumed and + the value. + + :param value: The binary value to decode + :rtype: :class:`tuple` (:class:`int`, :class:`int`) + :raises ValueError: when the binary data can not be unpacked + + """ + try: + return 1, common.Struct.short_short_uint.unpack_from(value[0:1])[0] + except TypeError: + raise ValueError('Could not unpack unsigned short-short integer value') + + def short_str(value: bytes) -> typing.Tuple[int, str]: """Decode a string value, returning bytes consumed and the value. @@ -262,8 +278,7 @@ """ try: temp = common.Struct.timestamp.unpack(value[0:8]) - return 8, datetime.datetime.fromtimestamp( - time.mktime(time.gmtime(temp[0]))) + return 8, datetime.datetime.utcfromtimestamp(temp[0]) except TypeError: raise ValueError('Could not unpack timestamp value') @@ -362,22 +377,25 @@ 'void': void, } # Define a data type mapping to methods for by_type() +# See https://www.rabbitmq.com/amqp-0-9-1-errata.html TABLE_MAPPING = { - b'\x00': void, - b'A': field_array, - b'B': short_short_int, - b'D': decimal, - b'd': double, - b'F': field_table, - b'f': floating_point, + b't': boolean, + b'b': short_short_int, + b'B': short_short_uint, + b's': short_int, + b'u': short_uint, b'I': long_int, b'i': long_uint, b'l': long_long_int, + b'L': long_long_int, + b'f': floating_point, + b'd': double, + b'D': decimal, b'S': long_str, - b's': short_int, - b't': boolean, + b'A': field_array, b'T': timestamp, - b'u': short_uint, + b'F': field_table, b'V': void, + b'\x00': void, # While not documented, have seen this in the wild b'x': byte_array, } # Define a mapping for use in `field_array()` and `field_table()` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/pamqp/encode.py new/pamqp-3.2.0/pamqp/encode.py --- old/pamqp-3.0.1/pamqp/encode.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/pamqp/encode.py 2022-06-27 16:39:36.000000000 +0200 @@ -69,7 +69,7 @@ """ if not isinstance(value, bool): raise TypeError('bool required, received {}'.format(type(value))) - return common.Struct.short_short.pack(int(value)) + return common.Struct.short_short_uint.pack(int(value)) def byte_array(value: bytearray) -> bytes: @@ -244,7 +244,10 @@ """ if isinstance(value, datetime.datetime): - value = value.timetuple() + if value.tzinfo is None or value.tzinfo.utcoffset(value) is None: + # assume datetime object is UTC + value = value.replace(tzinfo=datetime.timezone.utc) + return common.Struct.timestamp.pack(int(value.timestamp())) if isinstance(value, time.struct_time): return common.Struct.timestamp.pack(calendar.timegm(value)) raise TypeError( @@ -307,8 +310,8 @@ """ if DEPRECATED_RABBITMQ_SUPPORT: return _deprecated_table_integer(value) - if 0 <= value <= 255: - return b'B' + octet(value) + if -128 <= value <= 127: + return b'b' + octet(value) elif -32768 <= value <= 32767: return b's' + short_int(value) elif 0 <= value <= 65535: @@ -331,8 +334,8 @@ acceptable range for the data type """ - if 0 <= value <= 255: - return b'B' + octet(value) + if -128 <= value <= 127: + return b'b' + octet(value) elif -32768 <= value <= 32767: return b's' + short_int(value) elif -2147483648 <= value <= 2147483647: @@ -354,9 +357,10 @@ return encoder.pack(len(temp)) + temp -def encode_table_value(value: typing.Union[common.FieldArray, - common.FieldTable, - common.FieldValue]) -> bytes: +def encode_table_value( + value: typing.Union[common.FieldArray, common.FieldTable, + common.FieldValue] +) -> bytes: """Takes a value of any type and tries to encode it with the proper encoder :param value: Value to encode diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/pamqp/exceptions.py new/pamqp-3.2.0/pamqp/exceptions.py --- old/pamqp-3.0.1/pamqp/exceptions.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/pamqp/exceptions.py 2022-06-27 16:39:36.000000000 +0200 @@ -7,6 +7,7 @@ class UnmarshalingException(PAMQPException): """Raised when a frame is not able to be unmarshaled.""" + def __str__(self) -> str: # pragma: nocover return 'Could not unmarshal {} frame: {}'.format( self.args[0], self.args[1]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/pamqp/frame.py new/pamqp-3.2.0/pamqp/frame.py --- old/pamqp-3.0.1/pamqp/frame.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/pamqp/frame.py 2022-06-27 16:39:36.000000000 +0200 @@ -12,17 +12,14 @@ import struct import typing -from pamqp import (base, body, commands, common, constants, decode, - exceptions, header, heartbeat) +from pamqp import (base, body, commands, common, constants, decode, exceptions, + header, heartbeat) LOGGER = logging.getLogger(__name__) UNMARSHAL_FAILURE = 0, 0, None -FrameTypes = typing.Union[base.Frame, - body.ContentBody, - header.ContentHeader, - header.ProtocolHeader, - heartbeat.Heartbeat] +FrameTypes = typing.Union[base.Frame, body.ContentBody, header.ContentHeader, + header.ProtocolHeader, heartbeat.Heartbeat] def marshal(frame_value: FrameTypes, channel_id: int) -> bytes: @@ -90,8 +87,7 @@ def frame_parts(data: bytes) -> typing.Tuple[int, int, typing.Optional[int]]: """Attempt to decode a low-level frame, returning frame parts""" try: # Get the Frame Type, Channel Number and Frame Size - return struct.unpack( - '>BHI', data[0:constants.FRAME_HEADER_SIZE]) + return struct.unpack('>BHI', data[0:constants.FRAME_HEADER_SIZE]) except struct.error: # Did not receive a full frame return UNMARSHAL_FAILURE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/pamqp/header.py new/pamqp-3.2.0/pamqp/header.py --- old/pamqp-3.0.1/pamqp/header.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/pamqp/header.py 2022-06-27 16:39:36.000000000 +0200 @@ -39,8 +39,8 @@ ProtocolHeader frame. """ - return constants.AMQP + struct.pack( - 'BBBB', 0, self.major_version, self.minor_version, self.revision) + return constants.AMQP + struct.pack('BBBB', 0, self.major_version, + self.minor_version, self.revision) def unmarshal(self, data: bytes) -> int: """Dynamically decode the frame data applying the values to the method diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/setup.cfg new/pamqp-3.2.0/setup.cfg --- old/pamqp-3.0.1/setup.cfg 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/setup.cfg 2022-06-27 16:39:36.000000000 +0200 @@ -20,11 +20,11 @@ Natural Language :: English Operating System :: OS Independent Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: 3.10 Programming Language :: Python :: 3 :: Only - Programming Language :: SQL Topic :: Communications Topic :: Internet Topic :: Software Development @@ -38,7 +38,7 @@ include_package_data = True packages = pamqp -python_requires = >=3.6 +python_requires = >=3.7 zip_safe = true [options.extras_require] @@ -46,7 +46,7 @@ lxml requests yapf -test = +testing = coverage flake8 flake8-comprehensions @@ -56,15 +56,29 @@ flake8-quotes flake8-rst-docstrings flake8-tuple - nose + yapf [build_sphinx] all-files = 1 [coverage:run] branch = True +command_line = -m unittest discover tests --verbose data_file = build/.coverage +[coverage:report] +show_missing = True +include = + pamqp/* +omit = + tests/*.py + +[coverage:html] +directory = build/coverage + +[coverage:xml] +output = build/coverage.xml + [flake8] application-import-names = pamqp exclude = bak,build,docs,env,tools @@ -72,16 +86,3 @@ ignore = RST306 rst-directives = deprecated rst-roles = attr,class,const,data,exc,func,meth,mod,obj,py:class,py:mod - -[nosetests] -cover-branches = 1 -cover-html = true -cover-html-dir = build/coverage -cover-package = pamqp -cover-xml = true -cover-xml-file = build/coverage.xml -logging-level = DEBUG -verbosity = 2 -with-coverage = 1 -with-xunit = true -xunit-file = build/nosetests.xml diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/tests/test_decoding.py new/pamqp-3.2.0/tests/test_decoding.py --- old/pamqp-3.0.1/tests/test_decoding.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/tests/test_decoding.py 2022-06-27 16:39:36.000000000 +0200 @@ -11,7 +11,7 @@ class CodecDecodeTests(unittest.TestCase): - FIELD_ARR = (b'\x00\x00\x009B\x01u\xaf\xc8S\x00\x00\x00\x08Test \xe2\x9c' + FIELD_ARR = (b'\x00\x00\x009b\x01u\xaf\xc8S\x00\x00\x00\x08Test \xe2\x9c' b'\x88T\x00\x00\x00\x00Ec)\x92I\xbb\x9a\xca\x00D\x02\x00\x00' b'\x01:f@H\xf5\xc3i\xc4e5\xffl\x80\x00\x00\x00\x00\x00\x00' b'\x08') @@ -21,10 +21,10 @@ decimal.Decimal('3.14'), 3.14, 3294967295, -9223372036854775800 ] FIELD_TBL = ( - b'\x00\x00\x00\x99\x08arrayvalA\x00\x00\x00\x06B\x01B\x02B\x03\x07' + b'\x00\x00\x00\x99\x08arrayvalA\x00\x00\x00\x06b\x01b\x02b\x03\x07' b'boolvalt\x01\x06decvalD\x02\x00\x00\x01:\x07dictvalF\x00\x00\x00' b'\r\x04f\xe2\x9c\x89S\x00\x00\x00\x03\xe2\x9c\x90\x08floatvalf@H' - b'\xf5\xc3\x06intvalB\x01\x07longvalI6e&U\x06strvalS\x00\x00\x00\x08' + b'\xf5\xc3\x06intvalb\x01\x07longvalI6e&U\x06strvalS\x00\x00\x00\x08' b'Test \xe2\x9c\x88\x0ctimestampvalT\x00\x00\x00\x00Ec)\x92\x04\xf0' b'\x9f\x90\xb0V' ) @@ -100,7 +100,7 @@ self.assertRaises(ValueError, decode.decimal, False) def test_decode_double_value(self): - value = b'@\t!\xf9\xf0\x1B\x86n' + value = b'@\t!\xf9\xf0\x1b\x86n' self.assertEqual(round(decode.double(value)[1], 5), round(float(3.14159), 5)) @@ -174,10 +174,12 @@ self.assertIsInstance(decode.long_str(value)[1], str) def test_decode_long_str_data_type_unicode(self): - self.assertIsInstance( - decode.long_str(b'\x00\x00\x00\x0c\xd8\xa7' - b'\xd8\xae\xd8\xaa\xd8\xa8' - b'\xd8\xa7\xd8\xb1')[1], str) + value = b'\0\0\0\x0c\xd8\xa7\xd8\xae\xd8\xaa\xd8\xa8\xd8\xa7\xd8\xb1' + self.assertIsInstance(decode.long_str(value)[1], str) + + def test_decode_long_str_data_type_non_unicode(self): + value = b'\x00\x00\x00\x01\xff' + self.assertIsInstance(decode.long_str(value)[1], bytes) def test_decode_long_str_invalid_value(self): self.assertRaises(ValueError, decode.long_str, None) @@ -222,8 +224,11 @@ def test_decode_short_short_int_invalid_value(self): self.assertRaises(ValueError, decode.short_short_int, None) - def test_decode_short_short_int_value(self): - self.assertEqual(decode.short_short_int(b'\xff')[1], 255) + def test_decode_short_short_uint_value(self): + self.assertEqual(decode.short_short_uint(b'\xff')[1], 255) + + def test_decode_short_short_uint_invalid_value(self): + self.assertRaises(ValueError, decode.short_short_uint, None) def test_decode_short_str_bytes_consumed(self): self.assertEqual(decode.short_str(b'\n0123456789')[0], 11) @@ -629,10 +634,10 @@ self.assertEqual(decode.embedded_value(value)[0], 3) def test_decode_embedded_value_short_short_bytes_consumed(self): - self.assertEqual(decode.embedded_value(b'B\xff')[0], 2) + self.assertEqual(decode.embedded_value(b'b\xff')[0], 2) def test_decode_embedded_value_short_short_data_type(self): - self.assertIsInstance(decode.embedded_value(b'B\xff')[1], int) + self.assertIsInstance(decode.embedded_value(b'b\xff')[1], int) def test_decode_embedded_value_short_short_value(self): self.assertEqual(decode.embedded_value(b'B\xff')[1], 255) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/tests/test_encode_decode.py new/pamqp-3.2.0/tests/test_encode_decode.py --- old/pamqp-3.0.1/tests/test_encode_decode.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/tests/test_encode_decode.py 2022-06-27 16:39:36.000000000 +0200 @@ -1,4 +1,5 @@ # -*- encoding: utf-8 -*- +import datetime import unittest from pamqp import decode, encode @@ -14,3 +15,11 @@ encoded = encode.field_table(data) decoded = decode.field_table(encoded)[1] self.assertIn('A' * 128, decoded) + + def test_timestamp_with_dst(self): + # this test assumes the system is set up using a northern hemisphere + # timesone with DST (America/New_York as per github CI is fine) + data = datetime.datetime(2006, 5, 21, 16, 30, 10) + encoded = encode.timestamp(data) + decoded = decode.timestamp(encoded)[1] + self.assertEqual(decoded, data) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/tests/test_encoding.py new/pamqp-3.2.0/tests/test_encoding.py --- old/pamqp-3.0.1/tests/test_encoding.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/tests/test_encoding.py 2022-06-27 16:39:36.000000000 +0200 @@ -39,7 +39,7 @@ def test_encode_double(self): self.assertEqual(encode.double(float(3.14159)), - b'@\t!\xf9\xf0\x1B\x86n') + b'@\t!\xf9\xf0\x1b\x86n') def test_encode_floating_point_type(self): self.assertRaises(TypeError, encode.floating_point, '1234') @@ -145,8 +145,8 @@ self.assertRaises(TypeError, encode.timestamp, 'hi') def test_encode_field_array(self): - expectation = (b'\x00\x00\x00:B\x01u\xaf\xc8I\x02bZ\x00S\x00\x00\x00' - b'\x04TestT\x00\x00\x00\x00Ec)\x92I\xbB\x9a\xca\x00D' + expectation = (b'\x00\x00\x00:b\x01u\xaf\xc8I\x02bZ\x00S\x00\x00\x00' + b'\x04TestT\x00\x00\x00\x00Ec)\x92I\xbb\x9a\xca\x00D' b'\x02\x00\x00\x01:f@H\xf5\xc3i\xc4e5\xffl\x80\x00\x00' b'\x00\x00\x00\x00\x08') data = [ @@ -173,11 +173,11 @@ {'key': encode.field_table}) def test_encode_field_table(self): - expectation = (b"\x00\x00\x04'\x08arrayvalA\x00\x00\x00\x06B\x01B" - b'\x02B\x03\x07boolvalt\x01\tbytearrayx\x00\x00\x00' + expectation = (b"\x00\x00\x04'\x08arrayvalA\x00\x00\x00\x06b\x01b" + b'\x02b\x03\x07boolvalt\x01\tbytearrayx\x00\x00\x00' b'\x03AAA\x06decvalD\x02\x00\x00\x01:\x07dictvalF\x00' b'\x00\x00\x0c\x03fooS\x00\x00\x00\x03bar\x08floatval' - b'f@H\xf5\xc3\x06intvalB\x01\x07longstrS\x00\x00\x03t' + b'f@H\xf5\xc3\x06intvalb\x01\x07longstrS\x00\x00\x03t' b'000000000000000000000000000000000000000000000000000' b'011111111111111111111111111111111111111111111111111' b'112222222222222222222222222222222222222222222222222' @@ -236,8 +236,8 @@ self.assertEqual(encode.field_table(data), expectation) def test_encode_by_type_field_array(self): - expectation = (b'\x00\x00\x008B\x01sBhu\xaf\xc8S\x00\x00\x00\x04TestT' - b'\x00\x00\x00\x00Ec)\x92I\xbB\x9a\xca\x00D\x02\x00' + expectation = (b'\x00\x00\x008b\x01sBhu\xaf\xc8S\x00\x00\x00\x04TestT' + b'\x00\x00\x00\x00Ec)\x92I\xbb\x9a\xca\x00D\x02\x00' b'\x00\x01:f@H\xf5\xc3i\xc4e5\xffl\x80\x00\x00\x00\x00' b'\x00\x00\x08') data = [ @@ -286,7 +286,7 @@ b'\x00\x00\x00\x00Ec)\x92') def test_encode_by_type_field_table(self): - expectation = (b'\x00\x00\x04B\x08arrayvalA\x00\x00\x00\x08B\x01s\x10' + expectation = (b'\x00\x00\x04B\x08arrayvalA\x00\x00\x00\x08b\x01s\x10' b'`u\xa4\x10\x07boolvalt\x01\x06decvalD\x02\x00\x00\x01' b':\x07dictvalF\x00\x00\x00\x0c\x03fooS\x00\x00\x00\x03' b'bar\x08floatvalf@H\xf5\xc3\x07longstrS\x00\x00\x03t00' @@ -310,7 +310,7 @@ b'\x06s32intI\xc4e6\x00\x06s64intl7\x82\xda\xce\x9d\x90' b'\x00\x00\x06strvalS\x00\x00\x00\x04Test\x0ctimestamp' b'valT\x00\x00\x00\x00Ec)\x92\x06u16ints \x00\x06u32int' - b'i\xeek(\x00\x05u8bitB ') + b'i\xeek(\x00\x05u8bitb ') data = { 'u8bit': 32, 'u16int': 8192, @@ -364,7 +364,7 @@ def test_table_integer(self): tests = { - 'short-short': (32, b'B '), + 'short-short': (32, b'b '), 'short': (1024, b's\x04\x00'), 'short-negative': (-1024, b's\xfc\x00'), 'short-unsigned': (32768, b'u\x80\x00'), @@ -385,7 +385,7 @@ encode.support_deprecated_rabbitmq(True) self.assertTrue(encode.DEPRECATED_RABBITMQ_SUPPORT) tests = { - 'short-short': (32, b'B '), + 'short-short': (32, b'b '), 'short': (1024, b's\x04\x00'), 'short-negative': (-1024, b's\xfc\x00'), 'long': (65536, b'I\x00\x01\x00\x00'), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/tests/test_frame_unmarshaling.py new/pamqp-3.2.0/tests/test_frame_unmarshaling.py --- old/pamqp-3.0.1/tests/test_frame_unmarshaling.py 2020-08-07 18:39:49.000000000 +0200 +++ new/pamqp-3.2.0/tests/test_frame_unmarshaling.py 2022-06-27 16:39:36.000000000 +0200 @@ -336,7 +336,7 @@ 'reply_to': 'unmarshaling_tests', 'expiration': '1345274026', 'message_id': '746a1902-39dc-47cf-9471-9feecda35660', - 'timestamp': datetime.datetime(2012, 10, 2, 10, 51, 3), + 'timestamp': datetime.datetime(2012, 10, 2, 9, 51, 3), 'message_type': 'unittest', 'user_id': 'pika', 'app_id': 'frame_unmarshaling_tests', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pamqp-3.0.1/tests/test_tag_uri_scheme.py new/pamqp-3.2.0/tests/test_tag_uri_scheme.py --- old/pamqp-3.0.1/tests/test_tag_uri_scheme.py 1970-01-01 01:00:00.000000000 +0100 +++ new/pamqp-3.2.0/tests/test_tag_uri_scheme.py 2022-06-27 16:39:36.000000000 +0200 @@ -0,0 +1,27 @@ +import unittest + +from pamqp import commands + +# Tag uri examples from https://en.wikipedia.org/wiki/Tag_URI_scheme +TAG_URIS = [ + 'tag:[email protected],2001:web/externalHome', + 'tag:[email protected],2004-05:Sandro', + 'tag:my-ids.com,2001-09-15:TimKindberg:presentations:UBath2004-05-19', + 'tag:blogger.com,1999:blog-555', + 'tag:yaml.org,2002:int#section1' +] + + +class TagUriScheme(unittest.TestCase): + + def test_tag_uri_scheme_tag1(self): + commands.Exchange.Declare(exchange=TAG_URIS[0]) + + def test_tag_uri_scheme_tag2(self): + commands.Exchange.Declare(exchange=TAG_URIS[1]) + + def test_tag_uri_scheme_tag3(self): + commands.Exchange.Declare(exchange=TAG_URIS[2]) + + def test_tag_uri_scheme_tag4(self): + commands.Exchange.Declare(exchange=TAG_URIS[3])
