File: test_pickle.py

package info (click to toggle)
python-astropy 1.3-8~bpo8%2B2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 44,292 kB
  • sloc: ansic: 160,360; python: 137,322; sh: 11,493; lex: 7,638; yacc: 4,956; xml: 1,796; makefile: 474; cpp: 364
file content (23 lines) | stat: -rw-r--r-- 1,022 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
from ... import convolution as conv
from ...tests.helper import pytest, pickle_protocol, check_pickling_recovery

@pytest.mark.parametrize(("name","args","kwargs","xfail"),
                         [(conv.CustomKernel, [],
                           {'array':np.random.rand(15)},
                           False),
                          (conv.Gaussian1DKernel, [1.0],
                           {'x_size':5},
                           True),
                          (conv.Gaussian2DKernel, [1.0],
                           {'x_size':5, 'y_size':5},
                           True),
                         ])
def test_simple_object(pickle_protocol, name, args, kwargs, xfail):
    # Tests easily instantiated objects
    if xfail:
        pytest.xfail()
    original = name(*args, **kwargs)
    check_pickling_recovery(original, pickle_protocol)