This repository has been archived by the owner on Aug 28, 2022. It is now read-only.
forked from staylor-ds/pynorama
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request man-group#5 from manahl/add_python_tests
Unit tests, docstrings, and minor bugfixes
- Loading branch information
Showing
10 changed files
with
389 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
from mock import sentinel | ||
from pynorama.sessions.base_store import SessionStore | ||
|
||
|
||
class MockSessionStore(SessionStore): | ||
def save_sessions(self, view_name, sessions): | ||
pass | ||
|
||
def load_sessions(self, view_name): | ||
pass | ||
|
||
|
||
def test_base_session_store_save_sessions(): | ||
store = SessionStore() | ||
with pytest.raises(NotImplementedError) as e: | ||
store.save_sessions(sentinel.view_name, sentinel.sessions) | ||
assert 'Please implement save_sessions' in str(e) | ||
|
||
|
||
def test_base_session_store_load_sessions(): | ||
store = SessionStore() | ||
with pytest.raises(NotImplementedError) as e: | ||
store.load_sessions(sentinel.view_name) | ||
assert 'Please implement load_sessions' in str(e) | ||
|
||
|
||
def test_base_session_store_get_and_set_sessions(): | ||
store = MockSessionStore() | ||
store.set_sessions(sentinel.view_name, sentinel.sessions) | ||
assert sentinel.sessions == store.get_sessions(sentinel.view_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from mock import sentinel | ||
from pynorama.sessions.memory import InMemorySessionStore | ||
|
||
|
||
def test_memory_session_store_get_and_set_sessions(): | ||
store = InMemorySessionStore() | ||
store.set_sessions(sentinel.view_name, sentinel.sessions) | ||
assert sentinel.sessions == store.get_sessions(sentinel.view_name) | ||
|
||
|
||
def test_memory_session_store_get_sessions_nonexistent(): | ||
store = InMemorySessionStore() | ||
assert {} == store.get_sessions(sentinel.view_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.