Skip to content

Commit

Permalink
get code cooverage to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt711 committed Oct 31, 2024
1 parent a67bb8b commit 9551c1f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 1 addition & 5 deletions python/cudf_polars/cudf_polars/dsl/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,7 @@ def translate_expr(self, *, n: int) -> expr.Expr:
raise NotImplementedError(
"Could not retrieve the current expression"
) from e
try:
dtype = dtypes.from_polars(self.visitor.get_dtype(n))
except Exception as e:
self.errors.append(e)
raise NotImplementedError("Could not compute schema") from e
dtype = dtypes.from_polars(self.visitor.get_dtype(n))
try:
return _translate_expr(node, self, dtype)
except Exception as e:
Expand Down
12 changes: 11 additions & 1 deletion python/cudf_polars/tests/testing/test_asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@

import polars as pl

from cudf_polars.dsl.translate import Translator
from cudf_polars.testing.asserts import (
IRTranslationFailed,
assert_collect_raises,
assert_gpu_result_equal,
assert_ir_translation_raises,
)


def test_translation_assert_raises():
def test_translation_assert_raises(monkeypatch):
df = pl.LazyFrame({"a": [1, 2, 3]})

# This should succeed
Expand All @@ -35,6 +37,14 @@ class E(Exception):
# This should fail, because we can't translate this query, but it doesn't raise E.
assert_ir_translation_raises(unsupported, E)

def raise_unimplemented(self):
raise NotImplementedError("foo")

monkeypatch.setattr(Translator, "translate_ir", raise_unimplemented)

with pytest.raises(IRTranslationFailed):
assert_ir_translation_raises(df, NotImplementedError)


def test_collect_assert_raises():
df = pl.LazyFrame({"a": [1, 2, 3], "b": ["a", "b", "c"]})
Expand Down

0 comments on commit 9551c1f

Please sign in to comment.