You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently there are two failing tests on pypy, shown below.
I didn't notice them because I also apparently have tox misconfigured, so I don't think I actually was using pypy in my local tests. In my branch to test github actions I have pypy running, where I noticed the failure. https://github.com/terminal-labs/deep_collections/actions/runs/3914234772 That's commented out for now. I'd like to add that back in when these tests are fixed.
2 pypy test failures:
____________________________ TestTuple.test_getitem ____________________________
self = <tests.test_builtins.TestTuple object at 0x0000000003bd5590>
dc = DeepCollection(('nested', ('thing', 'spam')))
def test_getitem(self, dc):
assert dc[0] == "nested"
assert dc[1, 1] == "spam"
> assert isinstance(dc[1], self._type)
tests/conftest.py:89:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
deep_collections/__init__.py:720: in __getitem__
return DeepCollection(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'deep_collections.DeepCollection'>, args = ()
kwargs = {'match_args': (), 'match_kwargs': {}, 'match_with': 'glob', 'recursive_match_all': True}
obj = ('thing', 'spam'), dynamic_parent_cls = <class 'tuple'>
new_cls = <class 'deep_collections.DeepCollection_tuple'>
def __call__(cls, *args, **kwargs):
if args:
obj = args[0]
args = args[1:]
else:
obj = {}
# If a DC is given, we must use the original type as the parent_cls. We don't
# want or need to nest DC types, and we if we don't flattten the inheritence
# we get a metaclass conflict can't produce a consistent method resolution.
if hasattr(obj, "_obj") and isinstance(obj, DeepCollection):
dynamic_parent_cls = type(obj._obj)
else:
dynamic_parent_cls = type(obj)
# Make a new_cls that inherits from the dynamic_parent_cls, and resolve any
# potential metaclass conflicts, like when the object has its own metaclass
# already, as when it's an ABC.
try:
# Resultant type is deep_collections.DeepCollection_[type]
new_cls = type(
f"{cls.__name__}_{dynamic_parent_cls.__name__}",
(cls, dynamic_parent_cls),
{},
)
except TypeError:
# Resolve metaclass conflict.
# Create a new metaclass on the fly, merging the two we have.
mcls = type(cls)
cls.__class__ = type(
f"{mcls.__name__}_{dynamic_parent_cls.__name__}",
(mcls, type(dynamic_parent_cls)),
{},
)
# Resultant type is likely abc.DeepCollection_[type]
new_cls = type(
f"{cls.__name__}_{dynamic_parent_cls.__name__}",
(cls, dynamic_parent_cls),
{},
)
# Create the instance and initialize it with the given object.
# Sets obj in instance for immutables like tuple
# instance = new_cls.__new__(new_cls, obj, *args, **kwargs)
> instance = new_cls.__new__(new_cls, obj, *args, **kwargs)
E TypeError: __new__() got 4 unexpected keyword arguments
deep_collections/__init__.py:557: TypeError
_____________________________ TestTuple.test_slice _____________________________
self = <tests.test_builtins.TestTuple object at 0x0000000003bd5050>
def test_slice(self):
dc = DeepCollection(self._type([*range(10)]))
> assert dc[2:8] == self._type([2, 3, 4, 5, 6, 7])
tests/conftest.py:109:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
deep_collections/__init__.py:720: in __getitem__
return DeepCollection(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'deep_collections.DeepCollection'>, args = ()
kwargs = {'match_args': (), 'match_kwargs': {}, 'match_with': 'glob', 'recursive_match_all': True}
obj = (2, 3, 4, 5, 6, 7), dynamic_parent_cls = <class 'tuple'>
new_cls = <class 'deep_collections.DeepCollection_tuple'>
def __call__(cls, *args, **kwargs):
if args:
obj = args[0]
args = args[1:]
else:
obj = {}
# If a DC is given, we must use the original type as the parent_cls. We don't
# want or need to nest DC types, and we if we don't flattten the inheritence
# we get a metaclass conflict can't produce a consistent method resolution.
if hasattr(obj, "_obj") and isinstance(obj, DeepCollection):
dynamic_parent_cls = type(obj._obj)
else:
dynamic_parent_cls = type(obj)
# Make a new_cls that inherits from the dynamic_parent_cls, and resolve any
# potential metaclass conflicts, like when the object has its own metaclass
# already, as when it's an ABC.
try:
# Resultant type is deep_collections.DeepCollection_[type]
new_cls = type(
f"{cls.__name__}_{dynamic_parent_cls.__name__}",
(cls, dynamic_parent_cls),
{},
)
except TypeError:
# Resolve metaclass conflict.
# Create a new metaclass on the fly, merging the two we have.
mcls = type(cls)
cls.__class__ = type(
f"{mcls.__name__}_{dynamic_parent_cls.__name__}",
(mcls, type(dynamic_parent_cls)),
{},
)
# Resultant type is likely abc.DeepCollection_[type]
new_cls = type(
f"{cls.__name__}_{dynamic_parent_cls.__name__}",
(cls, dynamic_parent_cls),
{},
)
# Create the instance and initialize it with the given object.
# Sets obj in instance for immutables like tuple
# instance = new_cls.__new__(new_cls, obj, *args, **kwargs)
> instance = new_cls.__new__(new_cls, obj, *args, **kwargs)
E TypeError: __new__() got 4 unexpected keyword arguments
The text was updated successfully, but these errors were encountered:
Currently there are two failing tests on pypy, shown below.
I didn't notice them because I also apparently have tox misconfigured, so I don't think I actually was using pypy in my local tests. In my branch to test github actions I have pypy running, where I noticed the failure. https://github.com/terminal-labs/deep_collections/actions/runs/3914234772 That's commented out for now. I'd like to add that back in when these tests are fixed.
2 pypy test failures:
The text was updated successfully, but these errors were encountered: