Skip to content

Commit

Permalink
Remove call to magic 'locals' function from unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Coolbeth committed Jan 30, 2024
1 parent 80d5bf7 commit 6aef0de
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/unit/test_quilbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,15 @@ def def_frame(
center_frequency: Optional[float],
channel_delay: Optional[float],
) -> DefFrame:
optional_args = {k: v
for k, v in locals().items()
if k not in ["self", "frame"] and v is not None}
return DefFrame(frame, **optional_args)
args = dict(
direction=direction,
initial_frequency=initial_frequency,
hardware_object=hardware_object,
sample_rate=sample_rate,
center_frequency=center_frequency,
channel_delay=channel_delay,
)
return DefFrame(frame, **{k: v for k, v in args.items() if v is not None})

def test_out(self, def_frame: DefFrame, snapshot: SnapshotAssertion):
# The ordering of attributes isn't stable and can be printed in different orders across calls.
Expand Down

0 comments on commit 6aef0de

Please sign in to comment.