Skip to content

Commit

Permalink
Version 3.21rc0
Browse files Browse the repository at this point in the history
  • Loading branch information
mborsetti committed Apr 14, 2024
1 parent da3e347 commit 5dd1e01
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/test_differs.py
Expand Up @@ -628,7 +628,7 @@ def test_image_url(job_state: JobState) -> None:
# logging.getLogger('webchanges.differs').setLevel(level=logging.DEBUG)
job_state.old_data = 'https://aviationweather.gov/data/products/progs/F006_wpc_prog.gif'
job_state.new_data = 'https://aviationweather.gov/data/products/progs/F012_wpc_prog.gif'
job_state.job.differ = {'name': 'image', 'data_type': 'url', 'mse_treshold': 10}
job_state.job.differ = {'name': 'image', 'data_type': 'url', 'mse_threshold': 10}
expected = '\n'.join(
[
'Differ: image for url<br>',
Expand Down
3 changes: 2 additions & 1 deletion webchanges/differs.py
Expand Up @@ -809,7 +809,7 @@ class ImageDiffer(DifferBase):
"'url' (to retrieve an image), 'base_64' (Base 64 data) or 'filename' (the path to an image file) "
"(default: 'url')"
),
'mse_treshold': (
'mse_threshold': (
'the minimum mean squared error (MSE) between two images to consider them changed if numpy in installed '
'(default: 2.5)'
),
Expand Down Expand Up @@ -940,6 +940,7 @@ def compute_diff_image(img1: Image, img2: Image) -> tuple[Image, Optional[np.flo
return {'text': '', 'markdown': '', 'html': ''}

diff_image, mse_value = compute_diff_image(old_image, new_image)
logger.debug(f'Job {self.job.index_number}: MSE value {mse_value:.2f}')

if mse_value and mse_value < mse_threshold:
logger.info(
Expand Down

0 comments on commit 5dd1e01

Please sign in to comment.