]> Nutra Git (v2) - nutratech/cli.git/commitdiff
add todo; use/compare exc string in var
authorShane Jaroch <chown_tee@proton.me>
Fri, 12 Apr 2024 23:54:47 +0000 (19:54 -0400)
committerShane Jaroch <chown_tee@proton.me>
Sat, 13 Apr 2024 00:12:08 +0000 (20:12 -0400)
ntclient/core/nutprogbar.py
ntclient/services/bugs.py

index 9f30dd6fd1a3bc78b20a5e237ac8f47343fa76ba..dd40c3786150b927feae79a10d5fc189714c6f14 100644 (file)
@@ -48,8 +48,9 @@ def nutrient_progress_bars(
         for nutrient_id, amt in analysis.items():
             if nutrient_id not in nut_amts:
                 nut_amts[int(nutrient_id)] = amt
-            else:
-                nut_amts[int(nutrient_id)] += amt
+            else:  # pragma: no cover
+                # nut_amts[int(nutrient_id)] += amt
+                raise ValueError("Not implemented yet, need to sum up nutrient amounts")
 
     print_bars()
     return nut_amts
index 2cec060cfddd0318df0298df816dcf8609c50617..050d8af32b518526dcf12fcfda39cee487c9f3d8 100644 (file)
@@ -14,6 +14,8 @@ from ntclient import __db_target_nt__, __db_target_usda__, __version__
 from ntclient.persistence.sql.nt import sql as sql_nt
 from ntclient.utils import CLI_CONFIG
 
+# TODO: handle mocks in tests so coverage doesn't vary when bugs exist (vs. don't)
+
 
 def insert(args: list, exception: Exception) -> None:
     """Insert bug report into nt.sqlite3, return True/False."""
@@ -54,9 +56,10 @@ INSERT INTO bug
         )
     except sqlite3.IntegrityError as exc:
         print(f"WARN: {repr(exc)}")
-        if repr(exc) == (
-            "IntegrityError('UNIQUE constraint failed: " "bug.arguments, bug.stack')"
-        ):
+        dupe_bug_insertion_exc = (
+            "IntegrityError('UNIQUE constraint failed: bug.arguments, bug.stack')"
+        )
+        if repr(exc) == dupe_bug_insertion_exc:
             print("INFO: bug report already exists")
         else:
             raise