Ticket #2893 enhancement closed fixed

Opened 6 years ago

Last modified 6 years ago

assertEqual is hard to read.

Reported by: jml Owned by:
Priority: highest Milestone:
Component: trial Keywords:
Cc: Branch: branches/assertEqual-2893
Author: Launchpad Bug:

Description

We should do what bzrlib does.

Change History

1

Changed 6 years ago by jml

  • owner changed from glyph to jml
  • component changed from core to trial

2

Changed 6 years ago by jml

  • branch set to branches/assertEqual-2893

(In [21722]) Branching to 'assertEqual-2893'

3

Changed 6 years ago by jml

  • priority changed from normal to highest
  • owner changed from jml to radix
  • keywords review added

4

Changed 6 years ago by exarkun

  • owner changed from radix to jml
  • keywords review removed
  • in twisted/trial/test/test_assertions.py:
    • The new test method TestAssertions.test_failUnlessEqualMessage has no docstring.
    • The modified method _testUnequalPair on the same class also has no docstring.
  • in twisted/trial/unittest.py:
    • The docstring of failUnlessEqual used to say if msg is None, .... But if None is passed for msg now, the output is a bit ugly:
      twisted.trial.unittest.FailTest: Nonenot equal:
      
      maybe this case needs some test coverage?

The change is definitely an improvement. Something to think about for a wider scope of improvement (ie, beyond the scope of this ticket) might be to leave this formatting up to the reporter and just construct the exception with the objects it needs (making them publically available on the exception).

5

Changed 6 years ago by jml

  • owner changed from jml to exarkun
  • keywords review added

Definitely agree regarding wider scope, but that's a research project.

Added docstring and a new test for msg=None.

6

Changed 6 years ago by exarkun

  • owner changed from exarkun to jml
  • keywords review removed

Great, please merge.

7

Changed 6 years ago by jml

  • status changed from new to closed
  • resolution set to fixed

(In [21730]) Provide a more readable error message when assertEqual fails.

  • Author: jml
  • Reviewer: exarkun
  • Fixes #2893

assertEqual's error message now always includes the objects being compared. In addition, it displays these objects on separate lines and formats them with pprint.pformat.

8

Changed 2 years ago by <automation>

  • owner jml deleted
Note: See TracTickets for help on using tickets.