diff --git a/lib/model/image.py b/lib/model/image.py index 7174e8f..346e320 100644 --- a/lib/model/image.py +++ b/lib/model/image.py @@ -8,7 +8,7 @@ from lib import schemas class Model(Model): - def compute_pdq(iobytes: io.BytesIO) -> str: + def compute_pdq(self, iobytes: io.BytesIO) -> str: """Compute perceptual hash using ImageHash library :param im: Numpy.ndarray :returns: Imagehash.ImageHash diff --git a/test/lib/model/test_image.py b/test/lib/model/test_image.py index 3e31af0..acd9201 100644 --- a/test/lib/model/test_image.py +++ b/test/lib/model/test_image.py @@ -15,7 +15,7 @@ def test_compute_pdq(self, mock_pdq_hasher): image_content = file.read() mock_hasher_instance = mock_pdq_hasher.return_value mock_hasher_instance.fromBufferedImage.return_value.getHash.return_value.dumpBitsFlat.return_value = '1001' - result = Model.compute_pdq(io.BytesIO(image_content)) + result = Model().compute_pdq(io.BytesIO(image_content)) self.assertEqual(result, '0011100000111011010110100001001110001011110100100010101011010111010110101010000111001010111000001010111111110000000101110010000011111110111110100100011111010010110110101111101100111001000000010010100101010111110001001101101011000110001000001110010000111100') @patch("urllib.request.urlopen")