File tree Expand file tree Collapse file tree 2 files changed +30
-4
lines changed
Expand file tree Collapse file tree 2 files changed +30
-4
lines changed Original file line number Diff line number Diff line change 11import warnings
22import difflib
33import abc
4+ import operator as op
45import os
56from difflib import get_close_matches
67import atexit
@@ -112,10 +113,16 @@ def __init__(self) -> None:
112113 self ._result_sets = []
113114
114115 def append (self , result ):
115- map (self ._result_sets .pop , reversed ([
116- i for i , item in enumerate (self ._result_sets )
117- if len (result ) == len (item ) and map (op .eq , zip (result , item ))
118- ]))
116+ map (
117+ self ._result_sets .pop ,
118+ reversed (
119+ [
120+ i
121+ for i , item in enumerate (self ._result_sets )
122+ if len (result ) == len (item ) and map (op .eq , zip (result , item ))
123+ ]
124+ ),
125+ )
119126
120127 self ._result_sets .append (result )
121128
Original file line number Diff line number Diff line change @@ -1073,6 +1073,25 @@ def test_result_set_collection_append():
10731073 assert collection ._result_sets == [1 , 2 ]
10741074
10751075
1076+ def test_result_set_collection_append_numpy ():
1077+ try :
1078+ import numpy as np
1079+
1080+ a1 = np .array ([1 , 2 ])
1081+ a2 = np .array ([3 , 4 ])
1082+
1083+ collection = ResultSetCollection ()
1084+ collection .append (a1 )
1085+ collection .append (a2 )
1086+
1087+ assert len (collection ._result_sets ) == 2
1088+ assert collection ._result_sets [0 ] is a1
1089+ assert collection ._result_sets [1 ] is a2
1090+
1091+ except ImportError :
1092+ pass
1093+
1094+
10761095def test_result_set_collection_iterate ():
10771096 collection = ResultSetCollection ()
10781097 collection .append (1 )
You can’t perform that action at this time.
0 commit comments