Skip to content

Commit 0c96457

Browse files
committed
TESTS/DOC: added test and TODO for #1155
1 parent d349828 commit 0c96457

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

larray/core/group.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,13 @@ def __init__(self, key, name=None, axis=None):
752752
if isinstance(key, tuple):
753753
key = list(key)
754754
if isinstance(key, Group):
755+
# FIXME: this is wrong for slices. Triggering a problem with
756+
# this needs axes with labels in different order.
757+
# We should call .eval() instead, but we might want
758+
# to keep the slice as is (for performance reasons) when
759+
# possible (when slice evaluates to the same labels on
760+
# both axes). See #1155.
761+
# key = key.eval()
755762
key = key.to_label()
756763
self.key = remove_nested_groups(key)
757764

larray/tests/test_axis.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,15 @@ def test_getitem_group_keys():
240240
assert res.key == slice('a1', 'a2')
241241
assert res.axis is alt_a
242242

243+
alt2_a = Axis('a=a1,a0,a2')
244+
res = a[alt2_a.i[0:3]]
245+
assert isinstance(res, LGroup)
246+
# FIXME: we SHOULD have this result, but it is not what we currently
247+
# return (see #1155)
248+
# assert res.key == ['a1', 'a0', 'a2']
249+
assert res.key == slice('a1', 'a2')
250+
assert res.axis is a
251+
243252
key = a.i[[1, 2]]
244253

245254
res = a[key]

0 commit comments

Comments
 (0)