pixelogik/NearPy — pull request #32 by toogle (2014-12-17 13:24:16+00:00)
Title: Fix load_hash_configuration() to handle non-existent hash config

Currently an exception occurs when we trying to get a non-existent hash configuration from the storage (no matters Redis or memory), e.g.

```
>>> redis_object = Redis(host='redis', port=6379, db=0)
>>> redis_storage = RedisStorage(redis_object)
>>> config = redis_storage.load_hash_configuration('MyHash')
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/nearpy/storage/storage_redis.py", line 157, in load_hash_configuration
return pickle.loads(self.redis_object.get(hash_name+'_conf'))
File "/usr/lib/python2.7/pickle.py", line 1381, in loads
file = StringIO(str)
TypeError: expected read buffer, NoneType found
```

```
>>> memory_storage = MemoryStorage()
>>> config = memory_storage.load_hash_configuration('MyHash')
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python2.7/dist-packages/nearpy/storage/storage_memory.py", line 83, in load_hash_configuration
return self.hash_configs[hash_name]
KeyError: 'MyHash'
```

This PR fixes such behavior and adds additional tests.