podhmo / metashape

0 stars 1 forks source link

test is failed with Union type? #108

Closed podhmo closed 2 years ago

podhmo commented 2 years ago
...
metashape/tests/test_name.py::test_generics FAILED                       [ 20%]
metashape/tests/test_name.py::test_Literal PASSED                        [ 21%]
metashape/tests/test_name.py::test_Union FAILED                          [ 22%]
metashape/tests/test_name.py::test_NewType PASSED                        [ 23%]
...

=================================== FAILURES ===================================
________________________________ test_generics _________________________________

    def test_generics():
        import typing as t

        IntList = t.List[int]
        StrTuple1 = t.Tuple[str]
        StrTupleN = t.Tuple[str, ...]
        Commands = t.Dict[str, t.Callable[..., t.Any]]

        class Person:
            pass

        PersonDict = t.Dict[str, Person]

>       assert callFUT(IntList) == "IntList"
E       AssertionError: assert 'List' == 'IntList'
E         - IntList
E         + List

metashape/tests/test_name.py:45: AssertionError
__________________________________ test_Union __________________________________

    def test_Union():
        from typing import Union

        class X:
            pass

        class Y:
            pass

        XorY = Union[X, Y]
        XorY.__name__ = "XorY"
>       assert callFUT(XorY) == "XorY"
E       AssertionError: assert 'Union' == 'XorY'
E         - XorY
E         + Union

metashape/tests/test_name.py:74: AssertionError
=========================== short test summary info ============================
FAILED metashape/tests/test_name.py::test_generics - AssertionError: assert '...
FAILED metashape/tests/test_name.py::test_Union - AssertionError: assert 'Uni...
========================= 2 failed, 88 passed in 0.67s =========================
podhmo commented 2 years ago

the checking strategy of generics type's identity is changed, maybe.