Skip to content

Commit a77adf2

Browse files
committed
add tests
1 parent f26734f commit a77adf2

File tree

5 files changed

+84
-133
lines changed

5 files changed

+84
-133
lines changed

_duckdb-stubs/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ class Expression:
884884
def otherwise(self, value: Expression) -> Expression: ...
885885
def show(self) -> None: ...
886886
def when(self, condition: Expression, value: Expression) -> Expression: ...
887+
def try_(self, condition: Expression, value: Expression) -> Expression: ...
887888

888889
class FatalException(DatabaseError): ...
889890

src/duckdb_py/include/duckdb_python/expression/pyexpression.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct DuckDBPyExpression : public enable_shared_from_this<DuckDBPyExpression> {
8585

8686
// TRY
8787

88-
shared_ptr<DuckDBPyExpression> Try()
88+
shared_ptr<DuckDBPyExpression> Try();
8989

9090
// Order modifiers
9191

src/duckdb_py/pyexpression.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ shared_ptr<DuckDBPyExpression> DuckDBPyExpression::Try() {
232232
return DuckDBPyExpression::InternalUnaryOperator(ExpressionType::OPERATOR_TRY, *this);
233233
}
234234

235-
236235
// COALESCE
237236

238237
shared_ptr<DuckDBPyExpression> DuckDBPyExpression::Coalesce(const py::args &args) {
@@ -438,7 +437,6 @@ shared_ptr<DuckDBPyExpression> DuckDBPyExpression::SQLExpression(string sql) {
438437
return make_shared_ptr<DuckDBPyExpression>(std::move(expressions[0]));
439438
}
440439

441-
442440
// Private methods
443441

444442
shared_ptr<DuckDBPyExpression> DuckDBPyExpression::BinaryOperator(const string &function_name,

src/duckdb_py/pyexpression/initialize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ void DuckDBPyExpression::Initialize(py::module_ &m) {
373373
Returns:
374374
DuckDBPyExpression: TRY(self)
375375
)";
376-
expression.def("try", &DuckDBPyExpression::Try, docs);
376+
expression.def("try_", &DuckDBPyExpression::Try, docs);
377377

378378
docs = R"(
379379
Return the stringified version of the expression.

0 commit comments

Comments
 (0)