Skip to content

Commit

Permalink
Merge pull request #2445 from jfoster17/improve-translation-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog authored Sep 19, 2023
2 parents 0712156 + 298e6f7 commit 2a63c43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions glue/core/data_factories/tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ def test_translator_from_data():

with pytest.raises(ValueError) as exc:
df = data.get_object()
assert exc.value.args[0] == ('Specify the object class to use with cls= - supported '
'classes are:\n\n* pandas.core.frame.DataFrame')
# Do not specify full error message in case plugins add new translations
assert 'Specify the object class to use with cls' in exc.value.args[0]

df = data.get_object(cls=DataFrame)
assert_equal(list(df.columns), ['a', 'b', 'c'])
Expand Down
10 changes: 4 additions & 6 deletions glue/core/tests/test_data_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,8 @@ def test_get_object_explicit_class(self):

with pytest.raises(ValueError) as exc:
data.get_object()
assert exc.value.args[0] == ('Specify the object class to use with cls= - '
'supported classes are:\n\n* pandas.core.frame.DataFrame\n'
'* glue.core.tests.test_data_translation.FakeDataObject')
assert 'Specify the object class to use with cls' in exc.value.args[0]
assert 'glue.core.tests.test_data_translation.FakeDataObject' in exc.value.args[0]

obj = data.get_object(cls=FakeDataObject)
assert isinstance(obj, FakeDataObject)
Expand Down Expand Up @@ -142,9 +141,8 @@ def test_get_subset_object_explicit_class(self):

with pytest.raises(ValueError) as exc:
data.get_subset_object()
assert exc.value.args[0] == ('Specify the object class to use with cls= - '
'supported classes are:\n\n* pandas.core.frame.DataFrame\n'
'* glue.core.tests.test_data_translation.FakeDataObject')
assert 'Specify the object class to use with cls' in exc.value.args[0]
assert 'glue.core.tests.test_data_translation.FakeDataObject' in exc.value.args[0]

subset = data.get_subset_object(subset_id=0, cls=FakeDataObject)

Expand Down

0 comments on commit 2a63c43

Please sign in to comment.