Skip to content

Commit

Permalink
suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
amansingh2116 committed Jan 13, 2025
1 parent 5cf9c7d commit 2145b27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions piqture/neural_networks/qcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ def sequence(

# Prevent using BaseLayer itself
if layer is BaseLayer:
raise TypeError(
f"Operation at index {idx} cannot be BaseLayer itself, got *"
)
raise TypeError(f"Operation at index {idx} cannot be BaseLayer itself.")

# Validate parameters
if not isinstance(params, dict):
Expand Down
6 changes: 3 additions & 3 deletions tests/neural_networks/test_qcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_sequence(self, num_qubits, operations):
],
)
def test_non_baselayer_operation(self, num_qubits, operations):
"""Tests that classes not inheriting from BaseLayer are rejected."""
"""Tests if the layer operation inherits from the abstract BaseLayer class."""
with raises(
TypeError,
match=r"Operation at index \d+\ must inherit from BaseLayer, got \*?",
Expand All @@ -173,9 +173,9 @@ def test_non_baselayer_operation(self, num_qubits, operations):
[(2, [(BaseLayer, {})])],
)
def test_baselayer(self, num_qubits, operations):
"""Tests that BaseLayer itself is rejected."""
"""Tests if the layer operation is the abstract BaseLayer class."""
with raises(
TypeError,
match=r"Operation at index \d+\ cannot be BaseLayer itself, got \*?",
match=r"Operation at index \d+\ cannot be BaseLayer itself.",
):
_ = QCNN(num_qubits).sequence(operations)

0 comments on commit 2145b27

Please sign in to comment.