Skip to content

Commit 45323c6

Browse files
authored
Merge pull request #1032 from bluesky/add-missing-asserts
Add missing asserts in tests
2 parents 266347f + 1080dc7 commit 45323c6

12 files changed

+27
-18
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ Write the date in place of the "Unreleased" in the case a new version is release
33

44
# Changelog
55

6+
## v0.1.0-b31 (Unreleased)
7+
8+
### Fixed
9+
10+
- Tests were missing assertions to verify expected outcomes
11+
612
## v0.1.0-b30 (2025-07-18)
713

814
## Changed

tiled/_tests/test_access_control.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ def test_service_principal_access(tmpdir):
528528
build_app_from_config(config), api_key=key_info["secret"]
529529
) as context:
530530
sp_client = from_context(context)
531-
list(sp_client) == ["x"]
531+
assert list(sp_client) == ["x"]
532532

533533

534534
class CustomAttributesAuthenticator(DictionaryAuthenticator):

tiled/_tests/test_asset_access.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def test_include_data_sources_method_on_self(client):
3535
"Calling include_data_sources() fetches data sources on self."
3636
x = client.write_array([1, 2, 3], key="x")
3737
# Fetch data_sources on x object directly.
38-
x.data_sources() is not None
38+
assert x.data_sources() is not None
3939
# Fetch data_sources on x object, looked up in client.
40-
client["x"].data_sources() is not None
40+
assert client["x"].data_sources() is not None
4141
assert client["x"].include_data_sources().data_sources() is not None
4242

4343

tiled/_tests/test_caches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def f():
1616
d = OneShotCachedMap({"a": f})
1717
# These operations do not cause f to be called.
1818
len(d)
19-
"a" in d
19+
assert "a" in d
2020
list(d)
2121
assert counter == 0
2222

@@ -47,7 +47,7 @@ def f():
4747

4848
# These operations do not cause f to be called.
4949
len(d)
50-
"a" in d
50+
assert "a" in d
5151
list(d)
5252
assert counter == 0
5353

tiled/_tests/test_catalog.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,11 @@ async def test_sorting(a):
9898
assert reversed_default_key_order == list(reversed(default_key_order))
9999

100100
# Sort by key.
101-
await a.sort([("id", 1)]).keys_range(0, 10) == ordered_letters
101+
assert await a.sort([("id", 1)]).keys_range(0, 10) == ordered_letters
102102
# Test again, with items_range.
103-
[k for k, v in await a.sort([("id", 1)]).items_range(0, 10)] == ordered_letters
103+
assert [
104+
k for k, v in await a.sort([("id", 1)]).items_range(0, 10)
105+
] == ordered_letters
104106

105107
# Sort by letter metadata.
106108
# Use explicit 'metadata.{key}' namespace.

tiled/_tests/test_cli.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,5 +120,6 @@ def test_cli_version():
120120
from tiled import __version__
121121

122122
with run_cli("tiled --version") as process:
123+
assert process.stdout is not None
123124
line = process.stdout.readline()
124125
assert line.decode() == f"{__version__}{os.linesep}"

tiled/_tests/test_composite.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,4 +299,4 @@ def test_read_selective_with_dim0(context, dim0):
299299

300300
# Check the dimension names
301301
for var_name in ds.data_vars:
302-
ds[var_name].dims[0] == dim0
302+
assert ds[var_name].dims[0] == dim0

tiled/_tests/test_custom_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ async def test_xdi_round_trip(tmpdir):
5151
)
5252
client["example"].export(str(tmpdir / "exported.xdi"))
5353
actual = Path(tmpdir / "exported.xdi").read_text()
54-
actual
54+
assert actual is not None
5555
# XDI uses a two-space spacing that pandas.to_csv does not support.
5656
# Need thought to get this exactly right.
5757
# assert actual == data

tiled/_tests/test_metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
@router.get("/error")
2020
def error():
21-
1 / 0 # error!
21+
1 / 0 # type: ignore error!
2222

2323

2424
def total_request_time(client, code):

tiled/_tests/test_queries.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ def cm():
246246

247247
def test_not_and_and_or(client):
248248
with pytest.raises(TypeError):
249-
not (Key("color") == "red")
249+
not (Key("color") == "red") # type: ignore
250250
with pytest.raises(TypeError):
251-
(Key("color") == "red") and (Key("sample") == "Ni")
251+
(Key("color") == "red") and (Key("sample") == "Ni") # type: ignore
252252
with pytest.raises(TypeError):
253-
(Key("color") == "red") or (Key("sample") == "Ni")
253+
(Key("color") == "red") or (Key("sample") == "Ni") # type: ignore
254254

255255

256256
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)