Skip to content

Commit

Permalink
Fixup Test !E when None
Browse files Browse the repository at this point in the history
  • Loading branch information
asmacdo committed Sep 24, 2024
1 parent 5e564d1 commit 58dead2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/con_duct/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ def convert_field(self, value, conversion):
return self.color_word(self.NONE, self.RED)
elif conversion == "E": # colored non-zero is bad
return self.color_word(
value,
self.RED if value else self.GREEN,
value if value is not None else self.NONE,
self.RED if value or value is None else self.GREEN,
)
elif conversion == "X": # colored truthy
col = self.GREEN if value else self.RED
Expand Down
4 changes: 4 additions & 0 deletions test/test_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ def test_summary_formatter_E_e2e_colors() -> None:
e_zero_applied = formatter.format(e_format_string, **{"e": 0})
assert e_zero_applied == f"test {GREEN_START}0{formatter.RESET_SEQ}"

# # Test Red None
e_none_applied = formatter.format(e_format_string, **{"e": None})
assert e_none_applied == f"test {RED_START}-{formatter.RESET_SEQ}"


def test_summary_formatter_X_e2e() -> None:
formatter = SummaryFormatter()
Expand Down

0 comments on commit 58dead2

Please sign in to comment.