MCPcopy Create free account
hub / github.com/pytest-dev/pytest / accept

Method accept

src/_pytest/mark/expression.py:110–118  ·  view source on GitHub ↗
(self, type: TokenType, *, reject: bool = False)

Source from the content-addressed store, hash-verified

108 yield Token(TokenType.EOF, "", pos)
109
110 def accept(self, type: TokenType, *, reject: bool = False) -> Optional[Token]:
111 if self.current.type is type:
112 token = self.current
113 if token.type is not TokenType.EOF:
114 self.current = next(self.tokens)
115 return token
116 if reject:
117 self.reject((type,))
118 return None
119
120 def reject(self, expected: Sequence[TokenType]) -> "NoReturn":
121 raise ParseError(

Callers 4

expressionFunction · 0.80
exprFunction · 0.80
and_exprFunction · 0.80
not_exprFunction · 0.80

Calls 1

rejectMethod · 0.95

Tested by

no test coverage detected