コード例 #1
0
ファイル: test_diff.py プロジェクト: Cadair/astropy
    def test_different_dimensions(self):
        ia = np.arange(100).reshape(10, 10)
        ib = np.arange(100) - 1

        # Although ib could be reshaped into the same dimensions, for now the
        # data is not compared anyways
        diff = ImageDataDiff(ia, ib)
        assert not diff.identical
        assert diff.diff_dimensions == ((10, 10), (100,))
        assert diff.diff_total == 0

        report = diff.report()
        assert 'Data dimensions differ' in report
        assert 'a: 10 x 10' in report
        assert 'b: 100' in report
        assert 'No further data comparison performed.'
コード例 #2
0
 def test_not_identical_within_rtol_and_atol(self):
     ia = np.zeros((10, 10)) - 0.00001
     ib = np.zeros((10, 10)) - 0.00002
     diff = ImageDataDiff(ia, ib, rtol=1.0e-5, atol=1.0e-6)
     assert not diff.identical
     assert diff.diff_total == 100
コード例 #3
0
 def test_identical_within_relative_tolerance(self):
     ia = np.ones((10, 10)) - 0.00001
     ib = np.ones((10, 10)) - 0.00002
     diff = ImageDataDiff(ia, ib, rtol=1.0e-4)
     assert diff.identical
     assert diff.diff_total == 0
コード例 #4
0
 def test_trivial_identical_images(self):
     ia = np.arange(100).reshape(10, 10)
     ib = np.arange(100).reshape(10, 10)
     diff = ImageDataDiff(ia, ib)
     assert diff.identical
     assert diff.diff_total == 0