Skip to content

Deprecated assertEquals (and similar methods) don't work in marbles #85

@leifwalsh

Description

@leifwalsh
  • marbles.core version: 0.9.5
  • marbles.mixins version: 0.9.5
  • Python version: 3.6.5
  • Operating System: Linux

Description

Tried to run a unittest test that uses the deprecated name assertEquals instead of assertEqual.

What I Did

import marbles.core

class MyTestCase(marbles.core.TestCase):

    def test_assertEqual_success(self):
        x = 1
        y = 1
        self.assertEqual(x, y)

    def test_assertEqual_failure(self):
        x = 1
        y = 2
        self.assertEqual(x, y)

    def test_assertEquals_success(self):
        x = 1
        y = 1
        self.assertEquals(x, y)

    def test_assertEquals_failure(self):
        x = 1
        y = 2
        self.assertEquals(x, y)

The assertEquals tests fail with the following stack:

======================================================================
ERROR: test_deprecated_assertEquals_failure (tests.test_marbles.InterfaceTestCase) (use_annotated_test_case=False)
Does the deprecated assertEquals method work on failure?
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/leif/git/marbles/marbles/core/tests/test_marbles.py", line 373, in test_deprecated_assertEquals_failure
    self.case.test_deprecated_assertEquals_failure()
  File "/home/leif/git/marbles/marbles/core/tests/test_marbles.py", line 93, in test_deprecated_assertEquals_failure
    self.assertEquals(x, y)
  File "/home/leif/git/marbles/marbles/core/marbles/core/marbles.py", line 538, in wrapper
    return attr(*args, msg=annotation, **kwargs)
  File "/usr/lib64/python3.6/unittest/case.py", line 1323, in deprecated_func
    return original_func(*args, **kwargs)
TypeError: assertEqual() missing 1 required positional argument: 'second'

======================================================================
ERROR: test_deprecated_assertEquals_success (tests.test_marbles.InterfaceTestCase) (use_annotated_test_case=False)
Does the deprecated assertEquals method still work?
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/leif/git/marbles/marbles/core/tests/test_marbles.py", line 364, in test_deprecated_assertEquals_success
    self.case.test_deprecated_assertEquals_success()
  File "/home/leif/git/marbles/marbles/core/tests/test_marbles.py", line 88, in test_deprecated_assertEquals_success
    self.assertEquals(x, y)
  File "/home/leif/git/marbles/marbles/core/marbles/core/marbles.py", line 538, in wrapper
    return attr(*args, msg=annotation, **kwargs)
  File "/usr/lib64/python3.6/unittest/case.py", line 1323, in deprecated_func
    return original_func(*args, **kwargs)
TypeError: assertEqual() missing 1 required positional argument: 'second'

----------------------------------------------------------------------

Expected behavior

I expected assertEqual and assertEquals to behave the same. Instead, assertEqual does the expected thing, while assertEquals fails with a TypeError

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions