-
Notifications
You must be signed in to change notification settings - Fork 29
/
test_serialize.py
36 lines (27 loc) · 998 Bytes
/
test_serialize.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Check if pickle can serialize seabird's data objects
"""
import os
from glob import glob
import pickle
import numpy as np
from seabird.cnv import fCNV
def test_serialize_CNV():
""" Serialize CNV
"""
datadir = os.path.join(os.path.dirname(__file__), 'test_data')
for f in glob(os.path.join(datadir, "*.cnv.OK")):
profile = fCNV(f)
profile2 = pickle.loads(pickle.dumps(profile))
assert profile.attributes == profile2.attributes
assert (profile.data == profile.data)
def test_serialize_fCNV():
""" Serialize fCNV
"""
datadir = os.path.join(os.path.dirname(__file__), 'test_data')
for f in glob(os.path.join(datadir, "*.cnv.OK")):
profile = fCNV(f)
profile2 = pickle.loads(pickle.dumps(profile))
assert profile.attributes == profile2.attributes
assert (profile.data == profile.data)