pytest-dev / pytest-dev/unittest2pytest

Would be nice: fix assertEqual with singletons

Open
#52 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
141
Forks
28
PR merge metrics
No merged PRs in 30d

Description

Currently, unittest2pytest converts this:

self.assertEqual(thing, None)

to:

assert thing == None

which pylint then complains about (as it should).

Arguably, the original line was wrong, but it would be a nice touch if unittest2pytest noticed the value and converted it to:

assert thing is None

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating unittest2pytest's conversion of assertEqual in the Python source and its related tests. Add handling for comparisons against None so the output uses identity syntax, then verify that the existing conversion behavior remains unchanged and that the example produces assert thing is None.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.