File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4646 get_formatter ,
4747 reset_formatter ,
4848)
49- from datafusion .expr import Window
49+ from datafusion .expr import EXPR_TYPE_ERROR , Window
5050from pyarrow .csv import write_csv
5151
5252MB = 1024 * 1024
@@ -232,7 +232,8 @@ def test_select_mixed_expr_string(df):
232232
233233def test_select_unsupported (df ):
234234 with pytest .raises (
235- TypeError , match = r"Expected Expr or column name.*col\(\) or lit\(\)"
235+ TypeError ,
236+ match = f"Expected Expr or column name.*{ re .escape (EXPR_TYPE_ERROR )} " ,
236237 ):
237238 df .select (1 )
238239
@@ -288,7 +289,8 @@ def test_sort_string_and_expression_equivalent(df):
288289
289290def test_sort_unsupported (df ):
290291 with pytest .raises (
291- TypeError , match = r"Expected Expr or column name.*col\(\) or lit\(\)"
292+ TypeError ,
293+ match = f"Expected Expr or column name.*{ re .escape (EXPR_TYPE_ERROR )} " ,
292294 ):
293295 df .sort (1 )
294296
@@ -302,7 +304,7 @@ def test_aggregate_string_and_expression_equivalent(df):
302304
303305
304306def test_filter_string_unsupported (df ):
305- with pytest .raises (TypeError , match = r"col\(\) or lit\(\)" ):
307+ with pytest .raises (TypeError , match = re . escape ( EXPR_TYPE_ERROR ) ):
306308 df .filter ("a > 1" )
307309
308310
Original file line number Diff line number Diff line change 1515# specific language governing permissions and limitations
1616# under the License.
1717
18+ import re
1819from datetime import datetime , timezone
1920
2021import pyarrow as pa
2829 literal_with_metadata ,
2930)
3031from datafusion .expr import (
32+ EXPR_TYPE_ERROR ,
3133 Aggregate ,
3234 AggregateFunction ,
3335 BinaryExpr ,
@@ -886,5 +888,5 @@ def test_literal_metadata(ctx):
886888def test_ensure_expr ():
887889 e = col ("a" )
888890 assert ensure_expr (e ) is e .expr
889- with pytest .raises (TypeError , match = r"Use col\(\) or lit\(\)" ):
891+ with pytest .raises (TypeError , match = re . escape ( EXPR_TYPE_ERROR ) ):
890892 ensure_expr ("a" )
You can’t perform that action at this time.
0 commit comments