예제 #1
0
 def check(self, data):
     foo = Foo(data)
     bar = Bar()
     with h5tmp() as f:
         writer = Writer(f, from_object=foo)
         writer.crs('data')
         reader = Reader(f, to_object=bar)
         reader.crs('data')
         self.assertListEqual(foo.data, bar.data)
예제 #2
0
    def test_array(self):
        data = [ np.array([1,5,2]), np.array([6,0]), np.array([]), 
                 np.array([1,3,4]), np.array([7,]) ]

        foo = Foo(data)
        bar = Bar()
        with h5tmp() as f:
            writer = Writer(f, from_object=foo)
            writer.crs('data')
            reader = Reader(f, to_object=bar)
            reader.crs('data')
            np.testing.assert_array_equal(foo.data[0], bar.data[0])
            np.testing.assert_array_equal(foo.data[1], bar.data[1])
            np.testing.assert_array_equal(foo.data[2], bar.data[2])
            np.testing.assert_array_equal(foo.data[3], bar.data[3])
            np.testing.assert_array_equal(foo.data[4], bar.data[4])
예제 #3
0
 def check(self, data):
     foo = Foo(data)
     with h5tmp() as f:
         writer = Writer(f)
         writer.crs('data', data=data)
         reader = Reader(f)
         data_bis = reader.crs('data')
         self.assertListEqual(data, data_bis)
예제 #4
0
 def check(self, data):
     foo = {'data': data}
     bar = {}
     with h5tmp() as f:
         writer = Writer(f, from_dict=foo)
         writer.crs('data')
         reader = Reader(f, to_dict=bar)
         data_bis = reader.crs('data')
         self.assertListEqual(data, data_bis)
예제 #5
0
    def test_array(self):
        data = [ np.array([1,5,2]), np.array([6,0]), np.array([]), 
                 np.array([1,3,4]), np.array([7,]) ]

        foo = Foo(data)
        with h5tmp() as f:
            writer = Writer(f)
            writer.crs('data', data=data)
            reader = Reader(f)
            data_bis = reader.crs('data')
            for array1, array2 in zip(data, data_bis):
                np.testing.assert_array_equal(array1, array2)
예제 #6
0
    def test_array(self):
        data = [ np.array([1,5,2]), np.array([6,0]), np.array([]), 
                 np.array([1,3,4]), np.array([7,]) ]

        foo = {'data': data}
        bar = {}
        with h5tmp() as f:
            writer = Writer(f, from_dict=foo)
            writer.crs('data')
            reader = Reader(f, to_dict=bar)
            data_bis = reader.crs('data')
            for array1, array2 in zip(data, data_bis):
                np.testing.assert_array_equal(array1, array2)