Skip to content

Commit

Permalink
save_variables: Add wrapper load_variables function
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeio committed Dec 19, 2012
1 parent a3a06b4 commit 6a23fba
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
3 changes: 2 additions & 1 deletion save_ipython_variables/__init__.py
@@ -1,6 +1,7 @@
from save_ipython_variables.save_variables import (
load_all_variables,
load_variables,
save_variable,
)

__all__ = ['load_all_variables', 'save_variable']
__all__ = ['load_all_variables', 'save_variable', 'load_variables']
5 changes: 5 additions & 0 deletions save_ipython_variables/save_variables.py
Expand Up @@ -38,6 +38,11 @@ def _load_variable(name):
return True


def load_variables(variable_names):
"""Load :param variable_names: into the __builtins__ scope."""
return load_all_variables(variable_names=variable_names)


def load_all_variables(variable_names=None):
"""Loads all variables :param variable_names: into the __builtins__ scope.
Expand Down
21 changes: 20 additions & 1 deletion tests/integration.py
Expand Up @@ -3,7 +3,11 @@
from unittest import TestCase, main
import pickle

from save_ipython_variables import save_variable, load_all_variables
from save_ipython_variables import (
load_all_variables,
load_variables,
save_variable,
)


def remove_all_pickle_files():
Expand Down Expand Up @@ -166,6 +170,21 @@ def tearDown(self):
def test_raises_IOError(self):
self.assertRaises(IOError, load_all_variables)

####
##
## load_variables
##
####


class WhenLoadingVariables(WhenLoadingAllVariablesWithArgs):
"""Test is same as the parent class, but calls the more natural sounding
name in this context.
"""
def execute(self):
load_variables(['test_loading_variable_var_1'])


if __name__ == '__main__':
main()

0 comments on commit 6a23fba

Please sign in to comment.