@@ -91,7 +91,6 @@ def test_newline_in_query(self):
9191
9292 def test_any_filter_with_duplicate_hostname (self ):
9393 # Hostname shorthand triggers regex, but explicit attribute assignment doesn't
94- # Order: explicit assignment value comes first, then shorthand value
9594 result = parse_query ("web.* hostname=db.*" )
9695 expected = {"hostname" : Any (BaseFilter ("db.*" ), Regexp ("web.*" ))}
9796 assert_filters_equal (self , result , expected )
@@ -100,7 +99,6 @@ def test_invalid_function(self):
10099 with self .assertRaisesRegex (DatatypeError , r"Invalid function InvalidFunc" ):
101100 parse_query ("hostname=InvalidFunc(test)" )
102101
103-
104102 def test_top_level_literal_error (self ):
105103 with self .assertRaisesRegex (
106104 DatatypeError , r"Invalid term: Top level literals are not allowed"
@@ -127,14 +125,11 @@ def test_quoted_string(self):
127125 result = parse_function_string ('hostname="web 01"' )
128126 self .assertEqual (result , [("key" , "hostname" ), ("literal" , "web 01" )])
129127
130- def test_single_quoted_string (self ):
131128 result = parse_function_string ("hostname='web 01'" )
132129 self .assertEqual (result , [("key" , "hostname" ), ("literal" , "web 01" )])
133130
134- def test_escaped_quote (self ):
135131 result = parse_function_string ('hostname="web\\ "01"' )
136- # Note: string_buf stores the actual chars, but the result is the original slice
137- self .assertEqual (result [1 ][0 ], "literal" )
132+ self .assertEqual (result [1 ], ("literal" , 'web\\ "01' ))
138133
139134 def test_function_call (self ):
140135 result = parse_function_string ("num_cores=GreaterThan(4)" )
@@ -173,7 +168,6 @@ def test_invalid_escape(self):
173168 with self .assertRaisesRegex (DatatypeError , r"Invalid escape" ):
174169 parse_function_string ('hostname="web\\ 01"' , strict = True )
175170
176-
177171 def test_empty_string (self ):
178172 result = parse_function_string ("" )
179173 self .assertEqual (result , [])
@@ -191,7 +185,3 @@ def test_parentheses_handling(self):
191185 ("endfunc" , "" ),
192186 ]
193187 self .assertEqual (result , expected )
194-
195-
196- if __name__ == "__main__" :
197- unittest .main ()
0 commit comments