Skip to content

Commit

Permalink
refactor(common): move tests for re_extract to general suite
Browse files Browse the repository at this point in the history
  • Loading branch information
mesejo authored and cpcloud committed May 19, 2023
1 parent 9be9bf0 commit acd1774
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 57 deletions.
10 changes: 0 additions & 10 deletions ibis/backends/mysql/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,3 @@ def con_nodb():
return ibis.mysql.connect(
host=MYSQL_HOST, user=MYSQL_USER, password=MYSQL_PASS, port=MYSQL_PORT
)


@pytest.fixture(scope='module')
def alltypes(con):
return con.tables.functional_alltypes


@pytest.fixture(scope='module')
def df(alltypes):
return alltypes.execute()
47 changes: 0 additions & 47 deletions ibis/backends/mysql/tests/test_string.py

This file was deleted.

66 changes: 66 additions & 0 deletions ibis/backends/tests/test_string.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,72 @@ def test_string_col_is_unicode(alltypes, df):
),
],
),
param(
lambda t: t.date_string_col.re_extract(r'(\d+)\D(\d+)\D(\d+)', 1),
lambda t: t.date_string_col.str.extract(
r'(\d+)\D(\d+)\D(\d+)', expand=False
).iloc[:, 0],
id='re_extract_group_1',
marks=[
pytest.mark.notimpl(
["mssql", "druid", "oracle"],
raises=com.OperationNotDefinedError,
),
pytest.mark.broken(["impala"], raises=AssertionError),
],
),
param(
lambda t: t.date_string_col.re_extract(r'(\d+)\D(\d+)\D(\d+)', 2),
lambda t: t.date_string_col.str.extract(
r'(\d+)\D(\d+)\D(\d+)', expand=False
).iloc[:, 1],
id='re_extract_group_2',
marks=[
pytest.mark.notimpl(
["mssql", "druid", "oracle"],
raises=com.OperationNotDefinedError,
),
pytest.mark.broken(["impala", "clickhouse"], raises=AssertionError),
],
),
param(
lambda t: t.date_string_col.re_extract(r'(\d+)\D(\d+)\D(\d+)', 3),
lambda t: t.date_string_col.str.extract(
r'(\d+)\D(\d+)\D(\d+)', expand=False
).iloc[:, 2],
id='re_extract_group_3',
marks=[
pytest.mark.notimpl(
["mssql", "druid", "oracle"],
raises=com.OperationNotDefinedError,
),
pytest.mark.broken(["impala", "clickhouse"], raises=AssertionError),
],
),
param(
lambda t: t.date_string_col.re_extract(r'^(\d+)', 1),
lambda t: t.date_string_col.str.extract(r'^(\d+)', expand=False),
id='re_extract_group_at_beginning',
marks=[
pytest.mark.notimpl(
["mssql", "druid", "oracle"],
raises=com.OperationNotDefinedError,
),
pytest.mark.broken(["impala"], raises=AssertionError),
],
),
param(
lambda t: t.date_string_col.re_extract(r'(\d+)$', 1),
lambda t: t.date_string_col.str.extract(r'(\d+)$', expand=False),
id='re_extract_group_at_end',
marks=[
pytest.mark.notimpl(
["mssql", "druid", "oracle"],
raises=com.OperationNotDefinedError,
),
pytest.mark.broken(["impala", "dask", "pandas"], raises=AssertionError),
],
),
param(
lambda t: t.string_col.re_replace(r'[[:digit:]]+', 'a'),
lambda t: t.string_col.str.replace(r'\d+', 'a', regex=True),
Expand Down

0 comments on commit acd1774

Please sign in to comment.