Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full diff for list of strings wrong for multi-line string #10863

Open
chbndrhnns opened this issue Apr 4, 2023 · 4 comments · May be fixed by #10969 or #11688
Open

Full diff for list of strings wrong for multi-line string #10863

chbndrhnns opened this issue Apr 4, 2023 · 4 comments · May be fixed by #10969 or #11688
Assignees
Labels
topic: rewrite related to the assertion rewrite mechanism

Comments

@chbndrhnns
Copy link

When running this snippet using pytest -v test.py, the full diff output confuses me and I believe the first item with a "-" is wrong there.

# ./test.py

def test_():
    m = [
        "This is some dummy test which shows the strange way in which Pycharm"
        " displays the full diff."
    ]
    assert m == []

Output:

FAILED                                           [100%]
test_fulldiff.py:0 (test_)
['This is some dummy test which shows the strange way in which Pycharm '
 'displays the full diff.'] != []

<Click to see difference>

def test_():
        m = [
            "This is some dummy test which shows the strange way in which Pycharm"
            " displays the full diff."
        ]
>       assert m == []
E       AssertionError: assert ['This is some dummy test which shows the strange way in which Pycharm displays the full diff.'] == []
E         Left contains one more item: 'This is some dummy test which shows the strange way in which Pycharm displays the full diff.'
E         Full diff:
E           [
E         -  ,
E         +  'This is some dummy test which shows the strange way in which Pycharm '
E         +  'displays the full diff.',
E           ]

test_fulldiff.py:6: AssertionError
Compare with single-line string
FAILED                                           [100%]
test_fulldiff.py:0 (test_)
['This is some dummy test which shows the strange way in which Pycharm'] != []

Expected :[]
Actual   :['This is some dummy test which shows the strange way in which Pycharm']
<Click to see difference>

def test_():
        m = [
            "This is some dummy test which shows the strange way in which Pycharm"
        ]
>       assert m == []
E       AssertionError: assert ['This is some dummy test which shows the strange way in which Pycharm'] == []
E         Left contains one more item: 'This is some dummy test which shows the strange way in which Pycharm'
E         Full diff:
E         - []
E         + ['This is some dummy test which shows the strange way in which Pycharm']

test_fulldiff.py:5: AssertionError
Details

OS: mac OS 13.2.1
Python: 3.9.6

Package        Version
-------------- -------
attrs          22.2.0
exceptiongroup 1.1.1
fulldiff       0.1.0
iniconfig      2.0.0
packaging      23.0
pip            22.3.1
pluggy         1.0.0
pytest         7.2.2
setuptools     67.0.0
tomli          2.0.1
wheel          0.38.4
@Zac-HD Zac-HD added the topic: rewrite related to the assertion rewrite mechanism label Apr 8, 2023
@HSamiul
Copy link

HSamiul commented Apr 16, 2023

I will try to implement a solution in my own fork and hopefully make a PR for it. Is there any way to officially "claim" this issue?

@Pierre-Sassoulas
Copy link
Contributor

I assigned you to it @HSamiul, so that's official :)

@HSamiul
Copy link

HSamiul commented Apr 27, 2023

Hi! I am trying to understand the codebase as I work on this issue and something I'm struggling with is navigating the codebase to find the right file(s) to change in order to implement a solution to this issue.

Is there a guide anywhere that discusses how to navigate the repository to find where certain functionality/code is located? In my case, I'd be looking for the file(s) that format the diff-output to a terminal.

I have done a little digging around and read the contributing.rst file and other documentation in docs/en, which have been a little helpful, but I could use a nudge in the right direction for navigating/excavating the codebase.

On another note, if you have any advice for learning the codebase in general (code patterns, etc.), advice on that would be greatly appreciated.

Thanks!

@HomieOmie HomieOmie linked a pull request May 7, 2023 that will close this issue
@kayliny02
Copy link

kayliny02 commented Dec 3, 2023

Hi! My teammate @JamieC2002 and I are currently working on this issue and think we might have implemented a solution. Can we officially claim this issue since it seems like the previous PR has not been updated for a while? Thanks!

@JamieC2002 JamieC2002 linked a pull request Dec 8, 2023 that will close this issue
JamieC2002 added a commit to JamieC2002/pytest that referenced this issue Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: rewrite related to the assertion rewrite mechanism
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants