Beispiel #1
0
    def test_header_equal(self):
        s0 = Surface(self.surface_valid)
        s1 = Surface(self.surface_valid2)
        s2 = s0.copy()

        self.assertTrue(s0.headerEqual(s0))
        self.assertFalse(s0.headerEqual(s1))
        self.assertTrue(s0.headerEqual(s2))
Beispiel #2
0
    def test_header_equal(self):
        s0 = Surface( self.surface_valid )
        s1 = Surface( self.surface_valid2 )
        s2 = s0.copy( )

        self.assertTrue( s0.headerEqual( s0 ))
        self.assertFalse( s0.headerEqual( s1 ))
        self.assertTrue( s0.headerEqual( s2 ))
Beispiel #3
0
    def test_ops2(self):
        s0 = Surface(self.surface_small)
        surface_list = []
        for i in range(10):
            s = s0.copy()
            for j in range(len(s)):
                s[j] = random.random()
            surface_list.append(s)

        mean = s0.copy(copy_data=False)
        for s in surface_list:
            mean += s
        mean /= len(surface_list)

        std = s0.copy(copy_data=False)
        for s in surface_list:
            std += (s - mean) * (s - mean)
        std /= len(surface_list) - 1
Beispiel #4
0
    def test_ops2(self):
        s0 = Surface( self.surface_small )
        surface_list = []
        for i in range(10):
            s = s0.copy()
            for j in range(len(s)):
                s[j] = random.random()
            surface_list.append(s)

        mean = s0.copy( copy_data = False )
        for s in surface_list:
            mean += s
        mean /= len(surface_list)

        std = s0.copy( copy_data = False )
        for s in surface_list:
            std += (s - mean) * (s - mean)
        std /= (len(surface_list) - 1)
Beispiel #5
0
    def test_copy(self):
        with TestAreaContext("surface/copy"):
            s0 = Surface(self.surface_valid)
            s1 = s0.copy()

            self.assertTrue(s1 == s0)
            s1[0] = 99
            self.assertFalse(s1 == s0)
            del s0
            self.assertEqual(s1[0], 99)

            s2 = s1.copy(copy_data=False)
            self.assertEqual(s2[0], 0.0)
            self.assertEqual(s2[10], 0.0)
            self.assertEqual(s2[100], 0.0)
Beispiel #6
0
    def test_copy(self):
        with TestAreaContext("surface/copy"):
            s0 = Surface( self.surface_valid )
            s1 = s0.copy( )

            self.assertTrue( s1 == s0 )
            s1[0] = 99
            self.assertFalse( s1 == s0 )
            del s0
            self.assertEqual( s1[0] , 99)

            s2 = s1.copy( copy_data = False )
            self.assertEqual( s2[0] , 0.0 )
            self.assertEqual( s2[10] , 0.0 )
            self.assertEqual( s2[100] , 0.0 )