pytest-dev / pytest-dev/unittest2pytest

multi line assertion function replaced with invalid code

Open
#45 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

Consider the following code:

import unittest


class Tests(unittest.TestCase):
    def test_1(self):
        self.assertIn('multline line assert',
                      'multline line assert')

This is the output:

import unittest


class Tests(unittest.TestCase):
    def test_1(self):
        assert 'multline line assert' in
                      'multline line assert'

This is the correct output:

import unittest


class Tests(unittest.TestCase):
    def test_1(self):
        assert 'multline line assert' in 'multline line assert'

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

Reproduce the issue with the unittest snippet in the report and compare the invalid output with the expected output. Find the conversion handling for multiline assertIn calls; done means the generated assertion is valid Python and keeps both operands on the same line as shown.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.