Skip to content

Commit 4d8e124

Browse files
committed
test: cleanup and lint for unused arguments in test functions
1 parent 66ab2a5 commit 4d8e124

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+232
-250
lines changed

ibis/backends/athena/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def postload(self, **kw):
101101
self.connection = self.connect(schema_name=IBIS_ATHENA_TEST_DATABASE, **kw)
102102

103103
@staticmethod
104-
def connect(*, tmpdir, worker_id, **kw) -> BaseBackend:
104+
def connect(*, tmpdir, worker_id, **kw) -> BaseBackend: # noqa: ARG004
105105
return ibis.athena.connect(**CONNECT_ARGS, **kw)
106106

107107
def _remap_column_names(self, table_name: str) -> dict[str, str]:

ibis/backends/bigquery/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _load_data(self, **_: Any) -> None:
6464
query.result()
6565

6666
@staticmethod
67-
def connect(*, tmpdir, worker_id, **kw) -> Backend:
67+
def connect(*, tmpdir, worker_id, **kw) -> Backend: # noqa: ARG004
6868
"""Connect to the test project and dataset."""
6969
credentials, default_project_id = google.auth.default(
7070
scopes=EXTERNAL_DATA_SCOPES

ibis/backends/bigquery/tests/system/test_connect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def test_repeated_project_name(project_id, credentials):
3030
def test_project_id_different_from_default_credentials(monkeypatch):
3131
creds = mock.create_autospec(auth.Credentials)
3232

33-
def mock_credentials(*args, **kwargs):
33+
def mock_credentials(*_, **__):
3434
return creds, "default-project-id"
3535

3636
monkeypatch.setattr(pydata_google_auth, "default", mock_credentials)

ibis/backends/bigquery/tests/system/udf/test_udf_execute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def my_add(a: float, b: float) -> float:
4545
)
4646

4747

48-
def test_udf_with_struct(alltypes, df, snapshot):
48+
def test_udf_with_struct(alltypes, df):
4949
@udf.scalar.python
5050
def my_struct_thing(a: float, b: float) -> dt.Struct(
5151
{"width": float, "height": float}

ibis/backends/bigquery/tests/unit/udf/test_core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def f():
4040

4141

4242
def test_yield(snapshot):
43-
def f(a):
43+
def f(_):
4444
yield from [1, 2, 3]
4545

4646
js = compile(f)
@@ -235,7 +235,7 @@ def test_class_with_properties(snapshot):
235235

236236

237237
def test_set_to_object(snapshot):
238-
def f(a):
238+
def f(_):
239239
x = set()
240240
y = 1
241241
x.add(y)
@@ -246,7 +246,7 @@ def f(a):
246246

247247

248248
def test_setitem(snapshot):
249-
def f(a):
249+
def f(_):
250250
x = {}
251251
y = "2"
252252
x[y] = y
@@ -271,7 +271,7 @@ def f(a):
271271

272272
def test_scope_with_while(snapshot):
273273
def f():
274-
class Foo:
274+
class _:
275275
def do_stuff(self):
276276
while True:
277277
i = 1

ibis/backends/bigquery/tests/unit/udf/test_usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def my_len(s: str) -> float:
6666
def test_udf_int64(argument_type, return_type):
6767
# invalid argument type, valid return type
6868
@udf.scalar.python(signature=((argument_type,), return_type))
69-
def my_func(x):
69+
def my_func(_):
7070
return 1
7171

7272
expr = my_func(None)

ibis/backends/clickhouse/tests/conftest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,11 @@ def postload(self, **kw: Any):
7979

8080
@staticmethod
8181
def connect(
82-
*, tmpdir, worker_id, settings: Mapping[str, Any] | None = None, **kw: Any
82+
*,
83+
tmpdir, # noqa: ARG004
84+
worker_id, # noqa: ARG004
85+
settings: Mapping[str, Any] | None = None,
86+
**kw: Any,
8387
):
8488
if settings is None:
8589
settings = {}

ibis/backends/clickhouse/tests/test_aggregations.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,48 +45,48 @@ def test_reduction_invalid_where(alltypes, reduction):
4545
("func", "pandas_func"),
4646
[
4747
(
48-
lambda t, cond: t.bool_col.count(),
49-
lambda df, cond: df.bool_col.count(),
48+
lambda t, _: t.bool_col.count(),
49+
lambda df, _: df.bool_col.count(),
5050
),
5151
(
52-
lambda t, cond: t.bool_col.approx_nunique(),
53-
lambda df, cond: df.bool_col.nunique(),
52+
lambda t, _: t.bool_col.approx_nunique(),
53+
lambda df, _: df.bool_col.nunique(),
5454
),
5555
(
56-
lambda t, cond: t.double_col.sum(),
57-
lambda df, cond: df.double_col.sum(),
56+
lambda t, _: t.double_col.sum(),
57+
lambda df, _: df.double_col.sum(),
5858
),
5959
(
60-
lambda t, cond: t.double_col.mean(),
61-
lambda df, cond: df.double_col.mean(),
60+
lambda t, _: t.double_col.mean(),
61+
lambda df, _: df.double_col.mean(),
6262
),
6363
(
64-
lambda t, cond: t.int_col.approx_median(),
65-
lambda df, cond: df.int_col.median(),
64+
lambda t, _: t.int_col.approx_median(),
65+
lambda df, _: df.int_col.median(),
6666
),
6767
(
68-
lambda t, cond: t.double_col.min(),
69-
lambda df, cond: df.double_col.min(),
68+
lambda t, _: t.double_col.min(),
69+
lambda df, _: df.double_col.min(),
7070
),
7171
(
72-
lambda t, cond: t.double_col.max(),
73-
lambda df, cond: df.double_col.max(),
72+
lambda t, _: t.double_col.max(),
73+
lambda df, _: df.double_col.max(),
7474
),
7575
(
76-
lambda t, cond: t.double_col.var(),
77-
lambda df, cond: df.double_col.var(),
76+
lambda t, _: t.double_col.var(),
77+
lambda df, _: df.double_col.var(),
7878
),
7979
(
80-
lambda t, cond: t.double_col.std(),
81-
lambda df, cond: df.double_col.std(),
80+
lambda t, _: t.double_col.std(),
81+
lambda df, _: df.double_col.std(),
8282
),
8383
(
84-
lambda t, cond: t.double_col.var(how="sample"),
85-
lambda df, cond: df.double_col.var(ddof=1),
84+
lambda t, _: t.double_col.var(how="sample"),
85+
lambda df, _: df.double_col.var(ddof=1),
8686
),
8787
(
88-
lambda t, cond: t.double_col.std(how="pop"),
89-
lambda df, cond: df.double_col.std(ddof=0),
88+
lambda t, _: t.double_col.std(how="pop"),
89+
lambda df, _: df.double_col.std(ddof=0),
9090
),
9191
(
9292
lambda t, cond: t.bool_col.count(where=cond),

ibis/backends/clickhouse/tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,13 @@ def test_password_with_bracket():
380380
ibis.clickhouse.connect(host=host, user=user, port=port, password=quoted_pass)
381381

382382

383-
def test_from_url(con):
383+
def test_from_url():
384384
assert ibis.connect(
385385
f"clickhouse://{CLICKHOUSE_USER}:{CLICKHOUSE_PASS}@{CLICKHOUSE_HOST}:{CLICKHOUSE_PORT}/{IBIS_TEST_CLICKHOUSE_DB}"
386386
)
387387

388388

389-
def test_from_url_with_kwargs(con):
389+
def test_from_url_with_kwargs():
390390
# since explicit kwargs take precedence, this passes, because we're passing
391391
# `database` explicitly, even though our connection string says to use a
392392
# random database

ibis/backends/clickhouse/tests/test_functions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ def test_timestamp_cast(alltypes, assert_sql):
7878
assert_sql(result2, "out2.sql")
7979

8080

81-
def test_timestamp_now(con, assert_sql):
81+
def test_timestamp_now(assert_sql):
8282
expr = ibis.now()
8383
assert_sql(expr)
8484

8585

8686
@pytest.mark.parametrize("unit", ["y", "m", "d", "w", "h", "minute"])
87-
def test_timestamp_truncate(con, unit, assert_sql):
87+
def test_timestamp_truncate(unit, assert_sql):
8888
stamp = ibis.timestamp("2009-05-17 12:34:56")
8989
expr = stamp.truncate(unit)
9090
assert_sql(expr)

ibis/backends/databricks/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _load_data(self, **_: Any) -> None:
6666
cur.execute(stmt)
6767

6868
@staticmethod
69-
def connect(*, tmpdir, worker_id, **kw) -> BaseBackend:
69+
def connect(*, tmpdir, worker_id, **kw) -> BaseBackend: # noqa: ARG004
7070
return ibis.databricks.connect(
7171
server_hostname=env["DATABRICKS_SERVER_HOSTNAME"],
7272
http_path=env["DATABRICKS_HTTP_PATH"],

ibis/backends/datafusion/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _load_data(self, **_: Any) -> None:
3434
con.create_table("topk", topk)
3535

3636
@staticmethod
37-
def connect(*, tmpdir, worker_id, **kw):
37+
def connect(*, tmpdir, worker_id, **kw): # noqa: ARG004
3838
return ibis.datafusion.connect(**kw)
3939

4040
def _load_tpc(self, *, suite, scale_factor):

ibis/backends/datafusion/tests/test_udf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
with pytest.warns(FutureWarning, match="v9.0"):
1515

1616
@elementwise(input_type=["string"], output_type="int64")
17-
def my_string_length(arr, **kwargs):
17+
def my_string_length(arr, **_):
1818
# arr is a pyarrow.StringArray
1919
return pc.cast(pc.multiply(pc.utf8_length(arr), 2), target_type="int64")
2020

2121
@elementwise(input_type=[dt.int64, dt.int64], output_type=dt.int64)
22-
def my_add(arr1, arr2, **kwargs):
22+
def my_add(arr1, arr2, **_):
2323
return pc.add(arr1, arr2)
2424

2525
@reduction(input_type=[dt.float64], output_type=dt.float64)

ibis/backends/druid/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,5 +145,5 @@ def _load_data(self, **_: Any) -> None:
145145
fut.result()
146146

147147
@staticmethod
148-
def connect(*, tmpdir, worker_id, **kw):
148+
def connect(*, tmpdir, worker_id, **kw): # noqa: ARG004
149149
return ibis.connect(DRUID_URL, **kw)

ibis/backends/duckdb/tests/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def ddl_script(self) -> Iterator[str]:
9797
yield from super().ddl_script
9898

9999
@staticmethod
100-
def connect(*, tmpdir, worker_id, **kw) -> BaseBackend:
100+
def connect(*, tmpdir, worker_id, **kw) -> BaseBackend: # noqa: ARG004
101101
# use an extension directory per test worker to prevent simultaneous
102102
# downloads on windows
103103
#
@@ -150,12 +150,12 @@ def gpd():
150150

151151

152152
@pytest.fixture(scope="session")
153-
def zones(con, data_dir, gpd):
153+
def zones(con, data_dir):
154154
return con.read_geo(data_dir / "geojson" / "zones.geojson")
155155

156156

157157
@pytest.fixture(scope="session")
158-
def lines(con, data_dir, gpd):
158+
def lines(con, data_dir):
159159
return con.read_geo(data_dir / "geojson" / "lines.geojson")
160160

161161

@@ -170,7 +170,7 @@ def lines_gdf(data_dir, gpd):
170170

171171

172172
@pytest.fixture(scope="session")
173-
def geotable(con, gpd):
173+
def geotable(con):
174174
return con.table("geo")
175175

176176

ibis/backends/duckdb/tests/test_datatypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_cast_to_floating_point_type(con, snapshot, typ):
122122
snapshot.assert_match(sql, "out.sql")
123123

124124

125-
def null_literal(array_min_size: int = 0, array_max_size: int | None = None):
125+
def null_literal():
126126
true = st.just(True)
127127

128128
field_names = st.text(alphabet=string.ascii_lowercase + string.digits, min_size=1)
@@ -162,7 +162,7 @@ def null_literal(array_min_size: int = 0, array_max_size: int | None = None):
162162
)
163163

164164

165-
@h.given(lit=null_literal(array_min_size=1, array_max_size=8192))
165+
@h.given(lit=null_literal())
166166
@h.settings(suppress_health_check=[h.HealthCheck.function_scoped_fixture])
167167
def test_null_scalar(con, lit, monkeypatch):
168168
monkeypatch.setattr(ibis.options, "default_backend", con)

ibis/backends/duckdb/tests/test_decompile_tpch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def set_database(con, db):
7373
param(3, id="tpch03"),
7474
],
7575
)
76-
def test_parse_sql_tpch(tpch_query, snapshot, con, data_dir):
76+
def test_parse_sql_tpch(tpch_query, snapshot, con):
7777
tpch_query_file = SQL_QUERY_PATH / f"{tpch_query:02d}.sql"
7878
with open(tpch_query_file) as f:
7979
sql = f.read()

ibis/backends/duckdb/tests/test_geospatial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def test_create_table_geospatial_types(geotable, con):
262262

263263

264264
@pytest.mark.parametrize("expr", [point, point_geom])
265-
def test_literal_geospatial_explicit(con, expr, assert_sql):
265+
def test_literal_geospatial_explicit(expr, assert_sql):
266266
assert_sql(expr)
267267

268268

ibis/backends/exasol/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class TestConf(ServiceBackendTest):
3939
deps = ("pyexasol",)
4040

4141
@staticmethod
42-
def connect(*, tmpdir, worker_id, **kw: Any):
42+
def connect(*, tmpdir, worker_id, **kw: Any): # noqa: ARG004
4343
return ibis.exasol.connect(
4444
user=EXASOL_USER,
4545
password=EXASOL_PASS,

ibis/backends/flink/tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class TestConf(BackendTest):
8989
deps = "pandas", "pyflink"
9090

9191
@staticmethod
92-
def connect(*, tmpdir, worker_id, **kw: Any):
92+
def connect(*, tmpdir, worker_id, **kw: Any): # noqa: ARG004
9393
"""Flink backend is created in batch mode by default. This is to
9494
comply with the assumption that the tests under ibis/ibis/backends/tests/
9595
are for batch (storage or processing) backends.
@@ -125,7 +125,7 @@ def _load_data(self, **_: Any) -> None:
125125

126126
class TestConfForStreaming(TestConf):
127127
@staticmethod
128-
def connect(*, tmpdir, worker_id, **kw: Any):
128+
def connect(*, tmpdir, worker_id, **kw: Any): # noqa: ARG004
129129
"""Flink backend is created in streaming mode here. To be used
130130
in the tests under ibis/ibis/backends/flink/tests/.
131131
We only use mini cluster here for simplicity.

ibis/backends/impala/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def postload(self, **kw):
124124
self.connection = self.connect(database=env.test_data_db, **kw)
125125

126126
@staticmethod
127-
def connect(*, tmpdir, worker_id, **kw):
127+
def connect(*, tmpdir, worker_id, **kw): # noqa: ARG004
128128
env = IbisTestEnv()
129129
return ibis.impala.connect(host=env.impala_host, port=env.impala_port, **kw)
130130

ibis/backends/mssql/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _load_data(self, *, database: str = IBIS_TEST_MSSQL_DB, **_):
4747
super()._load_data(database=database, **_)
4848

4949
@staticmethod
50-
def connect(*, tmpdir, worker_id, **kw):
50+
def connect(*, tmpdir, worker_id, **kw): # noqa: ARG004
5151
return ibis.mssql.connect(
5252
host=MSSQL_HOST,
5353
user=MSSQL_USER,

ibis/backends/mssql/tests/test_client.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,3 +347,11 @@ def test_mssql_without_password_is_valid():
347347
)
348348
def test_list_tables_with_dash(con, database):
349349
assert con.list_tables(database=database)
350+
351+
352+
def test_rank_no_window_frame(snapshot):
353+
t = ibis.table(schema=dict(color=str, price=int), name="diamonds_sample")
354+
expr = t.mutate(ibis.rank().over(group_by="color", order_by="price"))
355+
sql = ibis.to_sql(expr, dialect="mssql")
356+
357+
snapshot.assert_match(sql, "out.sql")

ibis/backends/mssql/tests/test_window.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

ibis/backends/mysql/tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def _load_data(self, **kwargs: Any) -> None:
6161
cur.execute("\n".join(lines))
6262

6363
@staticmethod
64-
def connect(*, tmpdir, worker_id, **kw):
64+
def connect(*, tmpdir, worker_id, **kw): # noqa: ARG004
6565
return ibis.mysql.connect(
6666
host=MYSQL_HOST,
6767
user=MYSQL_USER,

0 commit comments

Comments
 (0)