Skip to content

Unit tests fails on Python 3.15.0b1 #759

Description

@hegjon

Latest main: 7ce55df

See also https://bugzilla.redhat.com/show_bug.cgi?id=2477406 for failure on release 4.15.0

jonny in typing_extensions/src on  main [!⇡] via 🐍 v3.14.5
❯ /home/jonny/Downloads/Python-3.15.0b1/python -m unittest discover
..............................................................................................................................................EEEE................................................s....ss....s............................E....F.................................................................................................................................................................EE.......................s.................................s.......................................F...s.s...ss......ssss.....s...............................s........F.....
======================================================================
ERROR: test_annotation_and_optional_default (test_typing_extensions.GetTypeHintTests.test_annotation_and_optional_default) (annotation='typing.Unpack[~Ts]', as_str=True, wrap_optional=False, none_default=False, expected_type_hints={'x': typing.Unpack[~Ts]})
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 1823, in test_annotation_and_optional_default
    type_hints = get_type_hints(func, globals(), locals(), include_extras=True)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 2503, in get_type_hints
    value = _eval_type(value, globalns, localns, (), format=format, owner=obj, prefer_fwd_module=True)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 475, in _eval_type
    return evaluate_forward_ref(t, globals=globalns, locals=localns,
                                type_params=type_params, owner=owner,
                                _recursive_guard=recursive_guard, format=format)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 1041, in evaluate_forward_ref
    value = forward_ref.evaluate(globals=globals, locals=locals,
                                 type_params=type_params, owner=owner, format=format)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/annotationlib.py", line 207, in evaluate
    return eval(code, globals=globals, locals=locals)
  File "<string>", line 1, in <module>
TypeError: bad operand type for unary ~: 'typing.TypeVarTuple'

======================================================================
ERROR: test_annotation_and_optional_default (test_typing_extensions.GetTypeHintTests.test_annotation_and_optional_default) (annotation='typing.Unpack[~Ts] | None', as_str=True, wrap_optional=True, none_default=False, expected_type_hints={'x': typing.Unpack[~Ts] | None})
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 1823, in test_annotation_and_optional_default
    type_hints = get_type_hints(func, globals(), locals(), include_extras=True)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 2503, in get_type_hints
    value = _eval_type(value, globalns, localns, (), format=format, owner=obj, prefer_fwd_module=True)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 475, in _eval_type
    return evaluate_forward_ref(t, globals=globalns, locals=localns,
                                type_params=type_params, owner=owner,
                                _recursive_guard=recursive_guard, format=format)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 1041, in evaluate_forward_ref
    value = forward_ref.evaluate(globals=globals, locals=locals,
                                 type_params=type_params, owner=owner, format=format)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/annotationlib.py", line 207, in evaluate
    return eval(code, globals=globals, locals=locals)
  File "<string>", line 1, in <module>
TypeError: bad operand type for unary ~: 'typing.TypeVarTuple'

======================================================================
ERROR: test_annotation_and_optional_default (test_typing_extensions.GetTypeHintTests.test_annotation_and_optional_default) (annotation='typing.Unpack[~Ts]', as_str=True, wrap_optional=False, none_default=True, expected_type_hints={'x': typing.Unpack[~Ts]})
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 1823, in test_annotation_and_optional_default
    type_hints = get_type_hints(func, globals(), locals(), include_extras=True)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 2503, in get_type_hints
    value = _eval_type(value, globalns, localns, (), format=format, owner=obj, prefer_fwd_module=True)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 475, in _eval_type
    return evaluate_forward_ref(t, globals=globalns, locals=localns,
                                type_params=type_params, owner=owner,
                                _recursive_guard=recursive_guard, format=format)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 1041, in evaluate_forward_ref
    value = forward_ref.evaluate(globals=globals, locals=locals,
                                 type_params=type_params, owner=owner, format=format)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/annotationlib.py", line 207, in evaluate
    return eval(code, globals=globals, locals=locals)
  File "<string>", line 1, in <module>
TypeError: bad operand type for unary ~: 'typing.TypeVarTuple'

======================================================================
ERROR: test_annotation_and_optional_default (test_typing_extensions.GetTypeHintTests.test_annotation_and_optional_default) (annotation='typing.Unpack[~Ts] | None', as_str=True, wrap_optional=True, none_default=True, expected_type_hints={'x': typing.Unpack[~Ts] | None})
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 1823, in test_annotation_and_optional_default
    type_hints = get_type_hints(func, globals(), locals(), include_extras=True)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 2503, in get_type_hints
    value = _eval_type(value, globalns, localns, (), format=format, owner=obj, prefer_fwd_module=True)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 475, in _eval_type
    return evaluate_forward_ref(t, globals=globalns, locals=localns,
                                type_params=type_params, owner=owner,
                                _recursive_guard=recursive_guard, format=format)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/typing.py", line 1041, in evaluate_forward_ref
    value = forward_ref.evaluate(globals=globals, locals=locals,
                                 type_params=type_params, owner=owner, format=format)
  File "/home/jonny/Downloads/Python-3.15.0b1/Lib/annotationlib.py", line 207, in evaluate
    return eval(code, globals=globals, locals=locals)
  File "<string>", line 1, in <module>
TypeError: bad operand type for unary ~: 'typing.TypeVarTuple'

======================================================================
ERROR: test_constructor (test_typing_extensions.NoExtraItemsTests.test_constructor)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 7976, in test_constructor
    self.assertIs(self.sentinel_type, type(self.sentinel_type)())
                                      ~~~~~~~~~~~~~~~~~~~~~~~~^^
TypeError: sentinel expected 1 argument, got 0

======================================================================
ERROR: test_sentinel_deprecated (test_typing_extensions.TestSentinels.test_sentinel_deprecated)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 9649, in test_sentinel_deprecated
    class SentinelSubclass(Sentinel):
        pass
TypeError: type 'sentinel' is not an acceptable base type

======================================================================
ERROR: test_sentinel_deprecated_explicit_repr (test_typing_extensions.TestSentinels.test_sentinel_deprecated_explicit_repr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 9604, in test_sentinel_deprecated_explicit_repr
    sentinel_explicit_repr = sentinel('sentinel_explicit_repr', repr='explicit_repr')
TypeError: sentinel() takes no keyword arguments

======================================================================
FAIL: test_repr (test_typing_extensions.NoExtraItemsTests.test_repr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 8017, in test_repr
    self.assertEqual(repr(NoExtraItems), f"{mod_name}.NoExtraItems")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'NoExtraItems' != 'typing.NoExtraItems'
- NoExtraItems
+ typing.NoExtraItems
? +++++++


======================================================================
FAIL: test_repr (test_typing_extensions.TypeVarTupleTests.test_repr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 6802, in test_repr
    self.assertEqual(repr(Ts), 'Ts')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: '~Ts' != 'Ts'
- ~Ts
? -
+ Ts


======================================================================
FAIL: test_repr (test_typing_extensions.UnpackTests.test_repr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jonny/projects/typing_extensions/src/test_typing_extensions.py", line 6604, in test_repr
    self.assertEqual(repr(Unpack[Ts]), f'{Unpack.__module__}.Unpack[Ts]')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 'typing.Unpack[~Ts]' != 'typing.Unpack[Ts]'
- typing.Unpack[~Ts]
?               -
+ typing.Unpack[Ts]


----------------------------------------------------------------------
Ran 571 tests in 0.519s

FAILED (failures=3, errors=7, skipped=16)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions