1
1
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
2
2
from __future__ import annotations
3
3
4
+ import pickle
5
+
4
6
import packaging .version
5
7
import pytest
6
8
7
9
import awkward as ak
8
- from awkward ._pickle import use_builtin_reducer
9
-
10
-
11
- @pytest .fixture
12
- def array_pickler ():
13
- import pickle
14
-
15
- with use_builtin_reducer ():
16
- yield pickle
17
-
18
10
19
11
SOME_ATTRS = {"foo" : "!SOME" }
20
12
OTHER_ATTRS = {"bar" : "!OTHER" , "foo" : "!OTHER" }
@@ -31,18 +23,18 @@ def test_set_attrs():
31
23
array .attrs = "Hello world!"
32
24
33
25
34
- def test_serialise_with_transient_attrs (array_pickler ):
26
+ def test_serialise_with_transient_attrs ():
35
27
attrs = {** SOME_ATTRS , "@transient_key" : lambda : None }
36
28
array = ak .Array ([1 , 2 , 3 ], attrs = attrs )
37
- result = array_pickler .loads (array_pickler .dumps (array ))
29
+ result = pickle .loads (pickle .dumps (array ))
38
30
assert result .attrs == SOME_ATTRS
39
31
40
32
41
- def test_serialise_with_nonserialisable_attrs (array_pickler ):
33
+ def test_serialise_with_nonserialisable_attrs ():
42
34
attrs = {** SOME_ATTRS , "non_transient_key" : lambda : None }
43
35
array = ak .Array ([1 , 2 , 3 ], attrs = attrs )
44
36
with pytest .raises (AttributeError , match = r"Can't pickle local object" ):
45
- array_pickler .loads (array_pickler .dumps (array ))
37
+ pickle .loads (pickle .dumps (array ))
46
38
47
39
48
40
def test_transient_metadata_persists ():
0 commit comments