Add punctuation to docstrings

This commit is contained in:
Julian Stirling 2025-07-10 02:03:02 +01:00
parent 4dc41bb008
commit 80beeea07b
34 changed files with 232 additions and 235 deletions

View file

@ -28,13 +28,13 @@ BASE_SCAN_DIR = os.path.join(tempfile.gettempdir(), "scans")
def _clear_scan_dir() -> None:
"""Delete the scan dir"""
"""Delete the scan dir."""
if os.path.exists(BASE_SCAN_DIR):
shutil.rmtree(BASE_SCAN_DIR)
def _add_fake_image(scan_dir: ScanDirectory) -> None:
"""Make a fake image on disk in the scan directory"""
"""Make a fake image on disk in the scan directory."""
unique = False
while not unique:
x_pos = random.randint(-10000, 10000)
@ -63,7 +63,7 @@ def _add_fake_file(
def _make_fake_dzi(scan_dir: ScanDirectory, n_layers: int = 8) -> None:
"""Create a fake DZI in a scan
"""Create a fake DZI in a scan.
:param n_layers: The number of layers of tiles. I.e. tile directories numbered
0...(n_layers-1) will be created. Default 8
@ -96,7 +96,7 @@ def _make_fake_dzi(scan_dir: ScanDirectory, n_layers: int = 8) -> None:
def test_basic_directory_operations():
"""Test some basic operations
"""Test some basic operations.
Test some basic operations, including:
- ScanDirectoryManager creates a scan directory
@ -156,7 +156,7 @@ def test_basic_directory_operations():
def test_scan_sequence_and_listing():
"""Check created scans are added in order and listed correctly"""
"""Check created scans are added in order and listed correctly."""
_clear_scan_dir()
scan_dir_manager = ScanDirectoryManager(BASE_SCAN_DIR)
# Make 4 scans
@ -183,7 +183,7 @@ def test_scan_sequence_and_listing():
def test_scan_name_non_sequential():
"""Check new scan has the correct name if the directories are not sequential"""
"""Check new scan has the correct name if the directories are not sequential."""
_clear_scan_dir()
os.makedirs(os.path.join(BASE_SCAN_DIR, "fake_scan_0001"))
os.makedirs(os.path.join(BASE_SCAN_DIR, "fake_scan_0002"))
@ -217,7 +217,7 @@ def test_all_scan_names_taken():
def test_no_scan_names_given():
"""Check correct default scan name is used if empty string is given"""
"""Check correct default scan name is used if empty string is given."""
_clear_scan_dir()
scan_dir_manager = ScanDirectoryManager(BASE_SCAN_DIR)
scan_dir = scan_dir_manager.new_scan_dir("")
@ -225,7 +225,7 @@ def test_no_scan_names_given():
def test_scan_info():
"""Test the scan info is correct even using fake scan data"""
"""Test the scan info is correct even using fake scan data."""
_clear_scan_dir()
scan_dir_manager = ScanDirectoryManager(BASE_SCAN_DIR)
scan_dir = scan_dir_manager.new_scan_dir("fake_scan")
@ -252,7 +252,7 @@ def test_scan_info():
def test_get_final_stitch():
"""Check that the final stitch can be retrieved"""
"""Check that the final stitch can be retrieved."""
_clear_scan_dir()
scan_dir_manager = ScanDirectoryManager(BASE_SCAN_DIR)
scan_dir = scan_dir_manager.new_scan_dir("fake_scan")
@ -280,7 +280,7 @@ def test_get_final_stitch():
def test_empty_scan_info():
"""Test the scan info is correct even if the scan is empty"""
"""Test the scan info is correct even if the scan is empty."""
_clear_scan_dir()
scan_dir_manager = ScanDirectoryManager(BASE_SCAN_DIR)
scan_dir = scan_dir_manager.new_scan_dir("fake_scan")
@ -298,7 +298,7 @@ def test_empty_scan_info():
def test_zipping_scan_data():
"""Test zipping the scan images with fake image data"""
"""Test zipping the scan images with fake image data."""
# Run twice, once calling the ScanDirectory directly,
# Once calling the ScanDirectoryManager
for caller in ["scan_dir", "manager"]:
@ -338,7 +338,7 @@ def test_zipping_scan_data():
def test_all_files():
"""Test all_files returns the path, and respects skipped directories"""
"""Test all_files returns the path, and respects skipped directories."""
_clear_scan_dir()
scan_dir_manager = ScanDirectoryManager(BASE_SCAN_DIR)
scan_dir = scan_dir_manager.new_scan_dir("fake_scan")
@ -393,7 +393,7 @@ def test_none_returned_for_missing_images_dir():
def test_extracting_files():
"""Test the private _find_files method of ScanDirectories
"""Test the private _find_files method of ScanDirectories.
Add files to directory and check expected returns.
"""
@ -445,7 +445,7 @@ DiskUsage = namedtuple("DiskUsage", ["total", "used", "free"])
@pytest.mark.parametrize("free_space", [500_000_001, 700_000_000, 5_000_000_000])
def test_disk_not_full(mocker, free_space):
"""Check no error thrown if disk has over 500MB of space"""
"""Check no error thrown if disk has over 500MB of space."""
total_space = 16_000_000_000
# Mock the disk_usage
mocker.patch(
@ -461,7 +461,7 @@ def test_disk_not_full(mocker, free_space):
@pytest.mark.parametrize("free_space", [100_000_000, 499_999_999])
def test_disk_full(mocker, free_space):
"""Check error thrown if disk has under 500MB of space"""
"""Check error thrown if disk has under 500MB of space."""
total_space = 16_000_000_000
# Mock the disk_usage
mocker.patch(