MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_ast_fstring_empty_format_spec

Method test_ast_fstring_empty_format_spec

Lib/test/test_fstring.py:502–518  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

500 self.assertEqual(fstring.end_col_offset, 18)
501
502 def test_ast_fstring_empty_format_spec(self):
503 expr = "f'{expr:}'"
504
505 mod = ast.parse(expr)
506 self.assertEqual(type(mod), ast.Module)
507 self.assertEqual(len(mod.body), 1)
508
509 fstring = mod.body[0].value
510 self.assertEqual(type(fstring), ast.JoinedStr)
511 self.assertEqual(len(fstring.values), 1)
512
513 fv = fstring.values[0]
514 self.assertEqual(type(fv), ast.FormattedValue)
515
516 format_spec = fv.format_spec
517 self.assertEqual(type(format_spec), ast.JoinedStr)
518 self.assertEqual(len(format_spec.values), 0)
519
520 def test_ast_fstring_format_spec(self):
521 expr = "f'{1:{name}}'"

Callers

nothing calls this directly

Calls 3

assertEqualMethod · 0.95
lenFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected