Skip to content

Simplify logic on TestCase.assertExpected() #2814

Closed
@datumbox

Description

@datumbox

🐛 Bug

My IDE spotted a tiny bug/readability issue on the TestCase.assertExpected() method:

vision/test/common_utils.py

Lines 153 to 159 in fdca307

equal = False
try:
equal = self.assertEqual(output, expected, prec=prec)
except Exception:
equal = False
if not equal:
return accept_output("updated output")

The method TestCase.assertEqual() does not return a value, hence if successful the variable equal will be None. The code still work but it can be simplified to improve readability:

            try:
                self.assertEqual(output, expected, prec=prec)
            except Exception:
                return accept_output("updated output")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions