Skip to content

Commit

Permalink
coverage ignore for exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
eliottrosenberg committed Jan 26, 2024
1 parent d264f06 commit d6cc9cb
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ def plot_heatmap(
_, axs = plt.subplots(1, 2, dpi=200, facecolor='white', figsize=(12, 4))

else:
if not len(axs) != 2 or type(axs[0]) != plt.Axes or type(axs[1]) != plt.Axes:
raise ValueError('axs should be a length-2 tuple of plt.Axes')
if (
not len(axs) != 2 or type(axs[0]) != plt.Axes or type(axs[1]) != plt.Axes
): # pragma: no cover
raise ValueError('axs should be a length-2 tuple of plt.Axes') # pragma: no cover
for ax, title, data in zip(
axs,
['$|0\\rangle$ errors', '$|1\\rangle$ errors'],
Expand All @@ -90,7 +92,7 @@ def plot_heatmap(
data_with_grid_qubit_keys = {}
for qubit in data:
if type(qubit) != grid_qubit.GridQubit:
raise TypeError(f'{qubit} must be of type cirq.GridQubit')
raise TypeError(f'{qubit} must be of type cirq.GridQubit') # pragma: no cover
data_with_grid_qubit_keys[qubit] = data[qubit] # just for typecheck
_, _ = cirq_heatmap.Heatmap(data_with_grid_qubit_keys).plot(
ax, annotation_format=annotation_format, title=title, **plot_kwargs
Expand Down

0 comments on commit d6cc9cb

Please sign in to comment.