From 94febbcbe28d4299593beae4518b1f7971ebc684 Mon Sep 17 00:00:00 2001 From: Kim Christie Date: Wed, 21 Oct 2026 14:36:56 +0100 Subject: [PATCH] File.name is a property, not a method --- src/hip/_content.py | 1 + tests/test_content.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hip/_content.py b/src/hip/_content.py index 2a3948d..94457b6 100644 --- a/src/hip/_content.py +++ b/src/hip/_content.py @@ -195,6 +195,7 @@ class File(Content): def __init__(self, path: str): self._path = path + @property def name(self) -> str: return os.path.basename(self._path) diff --git a/tests/test_content.py b/tests/test_content.py index 36d9540..1f0b3c0 100644 --- a/tests/test_content.py +++ b/tests/test_content.py @@ -176,7 +176,7 @@ def test_file(): "Content-Type": "text/plain; charset='utf-8'", "Content-Length": "12", } - assert file.name() == os.path.basename(temp.name) + assert file.name == os.path.basename(temp.name) with file.open() as stream: b = stream.read() assert b == b"Hello, world"