8383 Token (value = "AND" , type = TokenTypes .LOGIC_OPERATOR , position = (20 , 23 )),
8484 Token (value = "test" , type = TokenTypes .TERM , position = (24 , 28 )),
8585 Token (value = ")" , type = TokenTypes .PARENTHESIS_CLOSED , position = (28 , 29 )),
86+ Token (value = '"' , type = TokenTypes .TERM , position = (29 , 30 )),
8687 ],
8788 ),
8889 (
9394 Token (value = "(" , type = TokenTypes .PARENTHESIS_OPEN , position = (4 , 5 )),
9495 Token (value = "platform*" , type = TokenTypes .TERM , position = (5 , 14 )),
9596 Token (value = "OR" , type = TokenTypes .LOGIC_OPERATOR , position = (15 , 17 )),
96- Token (value = "digital work" , type = TokenTypes .TERM , position = (19 , 31 )),
97+ Token (value = ' "digital work' , type = TokenTypes .TERM , position = (18 , 31 )),
9798 Token (value = ")" , type = TokenTypes .PARENTHESIS_CLOSED , position = (31 , 32 )),
9899 Token (value = ")" , type = TokenTypes .PARENTHESIS_CLOSED , position = (32 , 33 )),
99100 ],
@@ -237,6 +238,19 @@ def test_tokenization(query_str: str, expected_tokens: list) -> None:
237238 },
238239 ],
239240 ),
241+ (
242+ '(TI=(platform* OR "digital work))' ,
243+ [
244+ {
245+ "code" : "PARSE_0003" ,
246+ "label" : "unbalanced-quotes" ,
247+ "message" : "Quotes are unbalanced in the query" ,
248+ "is_fatal" : True ,
249+ "position" : [(18 , 31 )],
250+ "details" : "Unmatched opening quote" ,
251+ }
252+ ],
253+ ),
240254 (
241255 "TI=term1 au= ti=" ,
242256 [
@@ -596,14 +610,6 @@ def test_tokenization(query_str: str, expected_tokens: list) -> None:
596610 "position" : [(17 , 21 )],
597611 "details" : "WOS fields must be before search terms and without brackets, e.g. AB=robot or TI=monitor. '[ti]' is invalid." ,
598612 },
599- {
600- "code" : "PARSE_0001" ,
601- "label" : "tokenizing-failed" ,
602- "message" : "Fatal error during tokenization" ,
603- "is_fatal" : True ,
604- "position" : [(9 , 21 )],
605- "details" : "Unparsed segment: 'ehealth[ti]'" ,
606- },
607613 ],
608614 ),
609615 (
@@ -614,8 +620,8 @@ def test_tokenization(query_str: str, expected_tokens: list) -> None:
614620 "label" : "unbalanced-quotes" ,
615621 "message" : "Quotes are unbalanced in the query" ,
616622 "is_fatal" : True ,
617- "position" : [(18 , 19 )],
618- "details" : "" ,
623+ "position" : [(18 , 31 )],
624+ "details" : "Unmatched opening quote " ,
619625 }
620626 ],
621627 ),
0 commit comments