Skip to content

.NET class instances considered Iterable #1234

@danabr

Description

@danabr

Environment

  • Pythonnet version: 2.5.0
  • Python version: 3.7
  • Operating System: Windows

Details

All .NET class instances are considered instances of collections.abc.Iterable.

namespace Python.Test {
  public class Empty { }
}
def test_not_Iterable():
    """Test regular .NET objects are not iterable"""
    from Python.Test import Empty
    from collections.abc import Iterable

    assert (not isinstance(Empty(), Iterable))

The test is expected to pass, but fails:

    def test_not_Iterable():
        """Test regular .NET objects are not iterable"""
        from Python.Test import Empty
        from collections.abc import Iterable

>       assert (not isinstance(Empty(), Iterable))
E       AssertionError: assert not True
E        +  where True = isinstance(<Python.Test.Empty object at 0x0000022D3E6DE5C8>, <class 'collections.abc.Iterable'>)
E        +    where <Python.Test.Empty object at 0x0000022D3E6DE5C8> = <class 'Python.Test.Empty'>()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy