Skip to content

Commit

Permalink
Adjust a few tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sgillies committed Mar 1, 2024
1 parent 8d0b52c commit 4fd6c41
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 3 additions & 2 deletions tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import datetime
import logging
from pathlib import Path
import random
import re
import sys
Expand Down Expand Up @@ -98,14 +99,14 @@ def shapefile(self, path_coutwildrnp_shp):

def test_open_repr(self, path_coutwildrnp_shp):
assert repr(self.c) == (
f"<open Collection '{path_coutwildrnp_shp}:coutwildrnp', "
f"<open Collection '{Path(path_coutwildrnp_shp).as_posix()}:coutwildrnp', "
f"mode 'r' at {hex(id(self.c))}>"
)

def test_closed_repr(self, path_coutwildrnp_shp):
self.c.close()
assert repr(self.c) == (
f"<closed Collection '{path_coutwildrnp_shp}:coutwildrnp', "
f"<closed Collection '{Path(path_coutwildrnp_shp).as_posix()}:coutwildrnp', "
f"mode 'r' at {hex(id(self.c))}>"
)

Expand Down
12 changes: 8 additions & 4 deletions tests/test_layer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
"""Layer tests."""

from pathlib import Path

import pytest

import fiona
Expand All @@ -18,14 +22,14 @@ def shapefile(self, path_coutwildrnp_shp):

def test_open_repr(self, path_coutwildrnp_shp):
assert repr(self.c) == (
f"<open Collection '{path_coutwildrnp_shp}:coutwildrnp', "
f"<open Collection '{Path(path_coutwildrnp_shp).as_posix()}:coutwildrnp', "
f"mode 'r' at {hex(id(self.c))}>"
)

def test_closed_repr(self, path_coutwildrnp_shp):
self.c.close()
assert repr(self.c) == (
f"<closed Collection '{path_coutwildrnp_shp}:coutwildrnp', "
f"<closed Collection '{Path(path_coutwildrnp_shp).as_posix()}:coutwildrnp', "
f"mode 'r' at {hex(id(self.c))}>"
)

Expand All @@ -42,14 +46,14 @@ def shapefile(self, data_dir):

def test_open_repr(self, data_dir):
assert repr(self.c) == (
f"<open Collection '{data_dir}:coutwildrnp', "
f"<open Collection '{Path(data_dir).as_posix()}:coutwildrnp', "
f"mode 'r' at {hex(id(self.c))}>"
)

def test_closed_repr(self, data_dir):
self.c.close()
assert repr(self.c) == (
f"<closed Collection '{data_dir}:coutwildrnp', "
f"<closed Collection '{Path(data_dir).as_posix()}:coutwildrnp', "
f"mode 'r' at {hex(id(self.c))}>"
)

Expand Down

0 comments on commit 4fd6c41

Please sign in to comment.