Exemplo n.º 1
0
def test_unwrap_explicit_indexer():
    indexer = indexing.BasicIndexer((1, 2))
    target = None

    unwrapped = indexing.unwrap_explicit_indexer(
        indexer, target, allow=indexing.BasicIndexer)
    assert unwrapped == (1, 2)

    with raises_regex(NotImplementedError, 'Load your data'):
        indexing.unwrap_explicit_indexer(
            indexer, target, allow=indexing.OuterIndexer)

    with raises_regex(TypeError, 'unexpected key type'):
        indexing.unwrap_explicit_indexer(
            indexer.tuple, target, allow=indexing.OuterIndexer)
Exemplo n.º 2
0
 def __getitem__(self, item):
     """Wrap getitem around the data."""
     item = indexing.unwrap_explicit_indexer(item,
                                             self,
                                             allow=(indexing.BasicIndexer,
                                                    indexing.OuterIndexer))
     return self.get_array()[item]
Exemplo n.º 3
0
 def __getitem__(self, item):
     """Wrap getitem around the data."""
     item = indexing.unwrap_explicit_indexer(
         item, self, allow=(indexing.BasicIndexer, indexing.OuterIndexer))
     return self.get_array()[item]