diff --git a/bitia/checksumdir.py b/bitia/checksumdir.py
index 5ebdff277503f1b567afcde9768c62e43b58a470..2cb5bd5270f28385cfa959e138bf68bb56651845 100644
--- a/bitia/checksumdir.py
+++ b/bitia/checksumdir.py
@@ -59,10 +59,7 @@ def filehash(filepath: Path, hashfunc: str = "sha256"):
     """Compute checksum of a file"""
     hasher = HASH_FUNCS[hashfunc]()
     blocksize = 64 * 1024
-
-    if not filepath.is_file():
-        return hasher.hexdigest()
-
+    assert filepath.is_file(), f"{filepath} is not a file"
     with filepath.open("rb") as fp:
         while True:
             data = fp.read(blocksize)
diff --git a/tests/test_methods.py b/tests/test_methods.py
index fa0fce7417740afbf1980d19f772d3c5ff680ecd..eb2645d61442440e5cd351850cceed88ae013aca 100644
--- a/tests/test_methods.py
+++ b/tests/test_methods.py
@@ -3,17 +3,30 @@ from pathlib import Path
 
 from bitia.common import sha256sum
 
+_common_hashes = {
+    "1": "6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b",
+    "123": "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3",
+    "abcdxyz": "bc5c610196f15a7e0d21a3af77b0e1740a4415a44d8a7ad4905d877825574bf9",
+}
+
 
 def test_filehash():
     tempdir = tempfile.gettempdir()
-    t1 = "ls -ltrh /"
-    t2 = "ls -ltrh"
     f1 = Path(tempdir) / "a.txt"
     f2 = Path(tempdir) / "b.txt"
+
+    for _c, _h in _common_hashes.items():
+        f1.write_text(_c)
+        assert f1.read_text() == _c
+        print(f"Computing hash of {f1}, content: {_c}")
+        assert sha256sum(f1) == _h
+
+    t1 = "ls -ltrh /"
     f1.write_text(t1)
     f2.write_text(t1)
     assert sha256sum(f1) == sha256sum(f2)
 
+    t2 = "ls -ltrh"
     f2.write_text(t2)
     assert sha256sum(f1) != sha256sum(f2)