Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:great-expectations/great_expecta…
Browse files Browse the repository at this point in the history
…tions into bugfix/ensure-proper-exit-code-for-dependency-graph-script
  • Loading branch information
cdkini committed Dec 13, 2021
2 parents f282051 + 6d4f871 commit 9f86996
Showing 1 changed file with 0 additions and 43 deletions.
43 changes: 0 additions & 43 deletions tests/data_context/test_data_context.py
Expand Up @@ -62,49 +62,6 @@ def parameterized_expectation_suite():
return json.load(suite)


def test_get_data_context_no_context_instantiated():
"""
What does this test and why?
The get_data_context() and set_data_context() methods were added as part of PR #3812 and #3819 which introduces a registry
for BaseDataContext. This PR introduces a registry for DataContext so that it is accessible throughout GE. The next 3 tests test this functionality.
This test tests whether the correct error is raised if we try to retrieve a BaseDataContext from a registry that has not been instantiated (set to None)
"""
BaseDataContext.set_data_context(None)
with pytest.raises(ge_exceptions.DataContextError) as e:
BaseDataContext.get_data_context()

assert (
"Could not retrieve DataContext from empty registry. Please instantiate DataContext before calling "
"get_data_context()" in str(e.value)
)


def test_get_data_context(titanic_data_context):
"""
This test tests whether the registry contains the identical data_context to the only that was passed in as a param.
"""
my_data_context: BaseDataContext = BaseDataContext.get_data_context()
assert my_data_context is not None
assert my_data_context is titanic_data_context


def test_set_data_context(
titanic_data_context, empty_data_context_with_config_variables
):
"""
This test tests whether the registry contains only the most recent data_context object.
"""
my_data_context: BaseDataContext = BaseDataContext.get_data_context()
assert my_data_context is empty_data_context_with_config_variables

# set as previous context
DataContext.set_data_context(titanic_data_context)
my_data_context: BaseDataContext = DataContext.get_data_context()
assert my_data_context is titanic_data_context


def test_create_duplicate_expectation_suite(titanic_data_context):
# create new expectation suite
assert titanic_data_context.create_expectation_suite(
Expand Down

0 comments on commit 9f86996

Please sign in to comment.