Fix bug in Resource.__getitem__ and move docstring example to module doctest