MCPcopy
hub / github.com/pytest-dev/pytest / not_expr

Function not_expr

src/_pytest/mark/expression.py:191–208  ·  view source on GitHub ↗
(s: Scanner)

Source from the content-addressed store, hash-verified

189
190
191def not_expr(s: Scanner) -> ast.expr:
192 if s.accept(TokenType.NOT):
193 return ast.UnaryOp(ast.Not(), not_expr(s))
194 if s.accept(TokenType.LPAREN):
195 ret = expr(s)
196 s.accept(TokenType.RPAREN, reject=True)
197 return ret
198 ident = s.accept(TokenType.IDENT)
199 if ident:
200 name = ast.Name(IDENT_PREFIX + ident.value, ast.Load())
201 if s.accept(TokenType.LPAREN):
202 ret = ast.Call(func=name, args=[], keywords=all_kwargs(s))
203 s.accept(TokenType.RPAREN, reject=True)
204 else:
205 ret = name
206 return ret
207
208 s.reject((TokenType.NOT, TokenType.LPAREN, TokenType.IDENT))
209
210
211BUILTIN_MATCHERS = {"True": True, "False": False, "None": None}

Callers 1

and_exprFunction · 0.85

Calls 4

exprFunction · 0.85
all_kwargsFunction · 0.85
acceptMethod · 0.80
rejectMethod · 0.80

Tested by

no test coverage detected