Skip to content

Commit 09abebe

Browse files
committed
993 ruff's opinions on test_layout.py
1 parent bcf731f commit 09abebe

File tree

1 file changed

+12
-31
lines changed

1 file changed

+12
-31
lines changed

tests/test_layout.py

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -311,20 +311,17 @@ def test_produces_layout_for_collection(self) -> None:
311311
)
312312
collection = self._get_collection()
313313
href = strategy.get_href(collection, parent_dir="http://example.com")
314-
assert (href ==
315-
"http://example.com/col/{}/{}/collection.json".format(
316-
collection.id, collection.license))
314+
assert href == "http://example.com/col/{}/{}/collection.json".format(
315+
collection.id, collection.license
316+
)
317317

318318
def test_produces_layout_for_collection_with_filename(self) -> None:
319319
template = "col/${id}/${license}/col.json"
320320
strategy = TemplateLayoutStrategy(collection_template=template)
321321
collection = self._get_collection()
322322
href = strategy.get_href(collection, parent_dir="http://example.com")
323-
assert (
324-
href ==
325-
"http://example.com/col/{}/{}/col.json".format(
326-
collection.id, collection.license
327-
)
323+
assert href == "http://example.com/col/{}/{}/col.json".format(
324+
collection.id, collection.license
328325
)
329326

330327
def test_produces_fallback_layout_for_collection(self) -> None:
@@ -344,21 +341,15 @@ def test_produces_layout_for_item(self) -> None:
344341
collection = self._get_collection()
345342
item = next(collection.get_items())
346343
href = strategy.get_href(item, parent_dir="http://example.com")
347-
assert (
348-
href ==
349-
f"http://example.com/item/{item.collection_id}/{item.id}.json"
350-
)
344+
assert href == f"http://example.com/item/{item.collection_id}/{item.id}.json"
351345

352346
def test_produces_layout_for_item_without_filename(self) -> None:
353347
template = "item/${collection}"
354348
strategy = TemplateLayoutStrategy(item_template=template)
355349
collection = self._get_collection()
356350
item = next(collection.get_items())
357351
href = strategy.get_href(item, parent_dir="http://example.com")
358-
assert (
359-
href ==
360-
f"http://example.com/item/{item.collection_id}/{item.id}.json"
361-
)
352+
assert href == f"http://example.com/item/{item.collection_id}/{item.id}.json"
362353

363354
def test_produces_fallback_layout_for_item(self) -> None:
364355
fallback = BestPracticesLayoutStrategy()
@@ -378,9 +369,7 @@ class TestBestPracticesLayoutStrategy:
378369
def test_produces_layout_for_root_catalog(self) -> None:
379370
strategy = BestPracticesLayoutStrategy()
380371
cat = pystac.Catalog(id="test", description="test desc")
381-
href = strategy.get_href(
382-
cat, parent_dir="http://example.com", is_root=True
383-
)
372+
href = strategy.get_href(cat, parent_dir="http://example.com", is_root=True)
384373
assert href == "http://example.com/catalog.json"
385374

386375
def test_produces_layout_for_child_catalog(self) -> None:
@@ -422,9 +411,7 @@ def test_catalog(self) -> None:
422411
with pytest.raises(ValueError):
423412
strategy.get_href(cat, parent_dir="http://example.com", is_root=True)
424413
cat.set_self_href("/an/href")
425-
href = strategy.get_href(
426-
cat, parent_dir="https://example.com", is_root=True
427-
)
414+
href = strategy.get_href(cat, parent_dir="https://example.com", is_root=True)
428415
assert href == expected_local_href
429416

430417
def test_collection(self) -> None:
@@ -435,9 +422,7 @@ def test_collection(self) -> None:
435422
collection = TestCases.case_8()
436423
collection.set_self_href(None)
437424
with pytest.raises(ValueError):
438-
strategy.get_href(
439-
collection, parent_dir="http://example.com", is_root=True
440-
)
425+
strategy.get_href(collection, parent_dir="http://example.com", is_root=True)
441426
collection.set_self_href("/an/href")
442427
href = strategy.get_href(
443428
collection, parent_dir="https://example.com", is_root=True
@@ -463,9 +448,7 @@ class TestAPILayoutStrategy:
463448
def test_produces_layout_for_root_catalog(self) -> None:
464449
strategy = APILayoutStrategy()
465450
cat = pystac.Catalog(id="test", description="test desc")
466-
href = strategy.get_href(
467-
cat, parent_dir="http://example.com", is_root=True
468-
)
451+
href = strategy.get_href(cat, parent_dir="http://example.com", is_root=True)
469452
assert href == "http://example.com"
470453

471454
def test_produces_layout_for_root_catalog_str(self) -> None:
@@ -494,9 +477,7 @@ def test_cannot_produce_layout_for_root_collection(self) -> None:
494477
strategy = APILayoutStrategy()
495478
collection = TestCases.case_8()
496479
with pytest.raises(ValueError):
497-
strategy.get_href(
498-
collection, parent_dir="http://example.com", is_root=True
499-
)
480+
strategy.get_href(collection, parent_dir="http://example.com", is_root=True)
500481

501482
def test_produces_layout_for_child_collection(self) -> None:
502483
strategy = APILayoutStrategy()

0 commit comments

Comments
 (0)