diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6b02912..bdb2bd0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: trailing-whitespace exclude: ^(docs|graphics|utils)/ @@ -12,26 +12,26 @@ repos: - id: detect-private-key - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.4.8 + rev: v0.11.8 hooks: - id: ruff exclude: ^(docs|graphics|utils)/ - repo: https://github.com/PyCQA/isort - rev: 5.13.2 + rev: 6.0.1 hooks: - id: isort args: ["--profile", "black"] exclude: ^(docs|graphics|utils)/ - repo: https://github.com/psf/black - rev: 24.4.2 + rev: 25.1.0 hooks: - id: black exclude: ^(docs|graphics|utils)/ - repo: https://github.com/PyCQA/pylint - rev: v3.3.1 + rev: v3.3.6 hooks: - id: pylint args: [--disable=import-error] diff --git a/tests/embeddings/image_embeddings/test_mcrqi.py b/tests/embeddings/image_embeddings/test_mcrqi.py new file mode 100644 index 0000000..acbc2c5 --- /dev/null +++ b/tests/embeddings/image_embeddings/test_mcrqi.py @@ -0,0 +1,24 @@ +"""Unit test for MCRQI class""" + +from __future__ import annotations + +import math +from unittest import mock + +import numpy as np +import pytest +from pytest import raises +from qiskit.circuit import QuantumCircuit + +from piqture.embeddings.image_embeddings.mcrqi import MCRQI + + +class TestMCRQI: + """Tests for MCRQI image representation class""" + + @pytest.mark.parametrize("img_dims, pixel_vals", [((2, 2), [list(range(4))])]) + def test_circuit_init(self, img_dims, pixel_vals): + """Tests MCRQI circuit initialization.""" + feature_dim = int(np.ceil(np.sqrt(math.prod(img_dims)))) + test_circuit = QuantumCircuit(feature_dim + 3) + assert MCRQI(img_dims, pixel_vals).circuit == test_circuit