Skip to content

Unexpected behaviour for generator expressions in python 3.7 #5371

@mbway

Description

@mbway

When running the following example with pytest 4.6.1 with python 3.6 from conda, the test passes, however when running with the same pytest version with python 3.7 the second assert statement fails

def test_example():
    assert all(list(x for x in [True, False] if x))
    assert all(x for x in [True, False] if x)
    def test_example():
        assert all(list(x for x in [True, False] if x))
>       assert all(x for x in [True, False] if x)
E       assert False

pytest_example.py:4: AssertionError

Conda requirements file:

name: pytest_test
channels:
  - conda-forge
  - defaults
dependencies:
  - python=3.7
  - pytest

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: rewriterelated to the assertion rewrite mechanismtype: bugproblem that needs to be addressedtype: regressionindicates a problem that was introduced in a release which was working previously

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions