Skip to content

Commit

Permalink
fix(tracer): lowercase traced bool
Browse files Browse the repository at this point in the history
  • Loading branch information
lt-mayonesa committed Nov 9, 2023
1 parent c36bbb1 commit a19f109
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hexagon/support/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, initial_cli_args: CliArgs):
def tracing(
self,
ref: str,
value: Union[str, Enum, list],
value: Union[str, Enum, list, bool],
key: str = None,
value_alias: str = None,
key_alias: str = None,
Expand All @@ -49,6 +49,8 @@ def tracing(
def to_str(v):
if isinstance(v, Enum):
return str(v.value)
elif isinstance(v, bool):
return str(v).lower()
return str(v)

if not key:
Expand Down
8 changes: 8 additions & 0 deletions tests/support/test_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,11 @@ def test_trace_enum_value_with_key():
assert tracer.trace() == "--name=a"
assert tracer.aliases_trace() == "-n=a"
assert tracer.has_traced() is True


def test_trace_boolean_values():
tracer = Tracer(parse_cli_args([]))
tracer.tracing(ref="proceed", value=True)
assert tracer.trace() == "true"
assert tracer.aliases_trace() == "true"
assert tracer.has_traced() is True

0 comments on commit a19f109

Please sign in to comment.