File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 11# Version history
22
3+ - Fixed NULL warning in fetch functions
4+
35## 1.0.0
46
57- Simplified authorization process for accessing restricted data via the new ` auth() ` function
Original file line number Diff line number Diff line change @@ -35,8 +35,13 @@ def _rpy2py_robject(listObject):
3535
3636robjects .conversion .set_conversion (robjects .default_converter + pandas2ri .converter + korapclient_converter )
3737
38- fix_lists_in_dataframes = robjects .default_converter
38+ fix_null_types = robjects .default_converter
39+
40+ @fix_null_types .rpy2py .register (NULLType )
41+ def to_str (obj ):
42+ return ""
3943
44+ fix_lists_in_dataframes = robjects .default_converter
4045
4146@fix_lists_in_dataframes .rpy2py .register (StrSexpVector )
4247def to_str (obj ):
Original file line number Diff line number Diff line change @@ -160,5 +160,17 @@ def test_unchained_fetch_matches(self):
160160 self .assertEqual (len (q .slots ['collectedMatches' ]), 220 )
161161 self .assertIsInstance (q .slots ['collectedMatches' ]['tokens.match' ].iloc [0 ], str )
162162
163+ def test_null_strings_are_handled (self ):
164+ q = self .kcon .corpusQuery ("Der" , vc = "corpusSigle=WPD17" , metadataOnly = False ).fetchNext ()
165+ matches = q .slots ['collectedMatches' ]
166+ self .assertFalse (
167+ matches ['tokens.left' ].str .contains ("rpy2.rinterface_lib.sexp.NULLType" , na = False ).any (),
168+ "The string 'rpy2.rinterface_lib.sexp.NULLType' was found in tokens.left!"
169+ )
170+ self .assertFalse (
171+ matches ['tokens.right' ].str .contains ("rpy2.rinterface_lib.sexp.NULLType" , na = False ).any (),
172+ "The string 'rpy2.rinterface_lib.sexp.NULLType' was found in tokens.right!"
173+ )
174+
163175if __name__ == '__main__' :
164176 unittest .main ()
You can’t perform that action at this time.
0 commit comments