MCPcopy Index your code
hub / github.com/nodejs/node / test

Method test

tools/inspector_protocol/jinja2/lexer.py:247–258  ·  view source on GitHub ↗

Test a token against a token expression. This can either be a token type or ``'token_type:token_value'``. This can only test against string values and types.

(self, expr)

Source from the content-addressed store, hash-verified

245 return self.type
246
247 def test(self, expr):
248 """Test a token against a token expression. This can either be a
249 token type or ``'token_type:token_value'``. This can only test
250 against string values and types.
251 """
252 # here we do a regular string equality check as test_any is usually
253 # passed an iterable of not interned strings.
254 if self.type == expr:
255 return True
256 elif ':' in expr:
257 return expr.split(':', 1) == [self.type, self.value]
258 return False
259
260 def test_any(self, *iterable):
261 """Test against multiple token expressions."""

Callers 15

test_anyMethod · 0.95
parseLineMethod · 0.45
lint-pr-url.mjsFile · 0.45
parseMethod · 0.45
_parse_blockMethod · 0.45
parse_ifMethod · 0.45
parse_import_contextMethod · 0.45
parse_includeMethod · 0.45
parse_contextMethod · 0.45
parse_notMethod · 0.45
parse_compareMethod · 0.45

Calls 1

splitMethod · 0.45

Tested by 4

test_anyMethod · 0.76
testFunction · 0.36
testFunction · 0.36
testFunction · 0.36