Skip to content

Unit Test Failure: AssertionError Lists Differ in tests/test_execute.py #10

@setoru

Description

@setoru

Description:
When executing the test case tests/test_execute.py::TestExecuteMany::test_executemany_client_failure_in_transaction, an AssertionError is thrown. The error occurs because two lists being compared have differing elements and orders.

Logs:

Traceback (most recent call last):
  File "/usr/lib64/python3.9/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib64/python3.9/unittest/case.py", line 592, in run
    self._callTestMethod(testMethod)
  File "/usr/lib64/python3.9/unittest/case.py", line 550, in _callTestMethod
    method()
  File "/home/gaussdbuser/gaussdb-python-async/.venv/lib64/python3.9/site-packages/async_gaussdb/_testbase/__init__.py", line 92, in wrapper
    self.loop.run_until_complete(coro)
  File "/usr/lib64/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/gaussdbuser/gaussdb-python-async/tests/test_execute.py", line 316, in test_executemany_client_failure_in_transaction
    self.assertEqual(
  File "/usr/lib64/python3.9/unittest/case.py", line 837, in assertEqual
    assertion_func(first, second, msg=msg)
  File "/usr/lib64/python3.9/unittest/case.py", line 1043, in assertListEqual
    self.assertSequenceEqual(list1, list2, msg, seq_type=list)
  File "/usr/lib64/python3.9/unittest/case.py", line 1025, in assertSequenceEqual
    self.fail(msg)
  File "/usr/lib64/python3.9/unittest/case.py", line 676, in fail
    raise self.failureException(msg)
AssertionError: Lists differ: [4, 5, 6, 7, 8, 9, 10, 11] != [11, 10, 9, 8, 7, 6, 5, 4]

First differing element 0:
4
11
- [4, 5, 6, 7, 8, 9, 10, 11]
+ [11, 10, 9, 8, 7, 6, 5, 4]

How to reproduce it:

pytest --durations=0 -s -v tests/test_execute.py

Expected Behavior
Test pass without AssertionError.

Actual Behavior
The test fails with an AssertionError as the lists [4, 5, 6, 7, 8, 9, 10, 11] and [11, 10, 9, 8, 7, 6, 5, 4] differ in both elements and order.

Environment

  • OS: Huawei Cloud EulerOS 2.0
  • Python Version: 3.9
  • Database: GaussDB Kernel 505.2.1.SPC0800 build 3e43b3bc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions