Selaa lähdekoodia

upd: adjusted code coverage
removed a block that by definition is never run and excluded another
block from code cov that is also never run by definition.

Mikael Koli 4 vuotta sitten
vanhempi
sitoutus
5fc4f8fc27
1 muutettua tiedostoa jossa 7 lisäystä ja 5 poistoa
  1. 7 5
      redmail/email/attachment.py

+ 7 - 5
redmail/email/attachment.py

@@ -107,10 +107,12 @@ class Attachments:
     def _get_filename(self, item):
         if isinstance(item, str):
             # Considered as path
-            if Path(item).is_file():
-                return Path(item).name
-            return item
+            # NOTE: the validation it is a file should already be
+            # done
+            return Path(item).name
         elif isinstance(item, PurePath):
             return item.name
-        else:
-            raise TypeError(f"Cannot figure out filename for {item}")
+        else: # pragma: no cover
+            # NOTE: this piece of code should not be run as the type check is
+            # done before. If this is run, then there is an unfinished feature.
+            raise NotImplementedError(f"Cannot figure out filename for {item}")