Esempio n. 1
0
    def test_random_visualizer_increased_tolerance(self):
        """
        Test that not close visualizers pass with increased tolerance
        """
        viz = RandomVisualizer(random_state=224).fit()
        viz.poof()

        self.assert_images_similar(viz, tol=30)
Esempio n. 2
0
    def test_random_visualizer(self):
        """
        Test that a random visualization is correctly compared to a baseline
        """
        viz = RandomVisualizer(random_state=111).fit()
        viz.poof()

        compare = self.assert_images_similar(viz, tol=1.0)
        assert_path_exists(compare.actual_image_path)
        assert_path_exists(compare.baseline_image_path)
Esempio n. 3
0
    def test_random_visualizer_not_close(self):
        """
        Test that not close visualizers raise an assertion error.
        """
        viz = RandomVisualizer(random_state=224).fit()
        viz.poof()

        with pytest.raises(ImageComparisonFailure, match="images not close"):
            self.assert_images_similar(viz)

        # Assert there is a diff
        assert_path_exists(
            ACTUAL_IMAGES, "test_meta", "test_random_visualizer_not_close-failed-diff.png"
        )
Esempio n. 4
0
    def test_missing_baseline_image(self):
        """
        Test that a missing basline image raises an exception
        """
        viz = RandomVisualizer(random_state=14).fit()
        viz.poof()

        # Assert the baseline image does not exist
        assert_path_not_exists(
            BASELINE_IMAGES, "test_meta", "test_missing_baseline_image.png"
        )

        with pytest.raises(ImageComparisonFailure, match="image does not exist"):
            self.assert_images_similar(viz)

        # Assert the actual image was created (to copy to baseline)
        assert_path_exists(
            ACTUAL_IMAGES, "test_meta", "test_missing_baseline_image.png"
        )