def nutrient_progress_bars(
_food_amts: Mapping[int, float],
_food_analyses: list,
- _nutrients: Mapping[int, list],
+ _nutrients: Mapping[int, tuple],
# grams: float = 100,
# width: int = 50,
) -> Mapping[int, float]:
def print_nutrient_bar(
- _n_id: int, _amount: float, _nutrients: Mapping[int, list]
+ _n_id: int, _amount: float, _nutrients: Mapping[int, tuple]
) -> tuple:
"""Print a single color-coded nutrient bar"""
nutrient = _nutrients[_n_id]
TODO: support -t (tabular/non-visual) output flag
"""
- def print_header(header: str) -> None:
- """Print a header for this method"""
- print()
- print("=========================")
- print(header)
- print("=========================")
-
##########################################################################
# Get analysis
##########################################################################
if CLI_CONFIG.debug:
substr = "{0} {1}".format(_rda, _nutrient[2]).ljust(12)
print("INJECT RDA: {0} --> {1}".format(substr, _nutrient[4]))
- nutrients = {int(x[0]): x for x in nutrients_lists}
+ nutrients = {int(x[0]): tuple(x) for x in nutrients_lists}
+ print(nutrients)
# Analyze foods
foods_analysis = {}
def day_format(
- analysis: Mapping[int, float], nutrients: Mapping[int, list], buffer: int = 0
+ analysis: Mapping[int, float],
+ nutrients: Mapping[int, tuple],
+ buffer: int = 0,
) -> None:
"""Formats day analysis for printing to console"""
# Nutrition detail report
print_header("Nutrition detail report")
- for n_id in analysis:
- print_nutrient_bar(n_id, analysis[n_id], nutrients)
+ for nutr_id, nutr_val in analysis.items():
+ print_nutrient_bar(nutr_id, nutr_val, nutrients)
# TODO: actually filter and show the number of filtered fields
print(
"work in progress...",
source = ntclient
[coverage:report]
-fail_under = 85.00
+fail_under = 90.00
precision = 2
show_missing = True
17.11,
)
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ # Bug
+ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ args = arg_parser.parse_args(args="bug".split())
+ code, result = args.func(args)
+ assert code == 0
+ assert isinstance(result, list)
+ args = arg_parser.parse_args(args="bug --show".split())
+ code, result = args.func(args)
+ assert code == 0
+ assert isinstance(result, list)
+
def test_415_invalid_path_day_throws_error(self):
"""Ensures invalid path throws exception in `day` subcommand"""
invalid_day_csv_path = os.path.join(
)
assert output
+ @unittest.expectedFailure
+ @pytest.mark.xfail(reason="Work in progress, need to get mocks working")
def test_1000_bugs(self):
"""Tests the functions for listing and submitting bugs"""
bugs.list_bugs()