MCPcopy Create free account
hub / github.com/coooodeer/parse-rust / test_format_variety

Function test_format_variety

tests/test_pattern.py:44–67  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42
43
44def test_format_variety():
45 def _(fmt, matches):
46 d = parse.extract_format(fmt, {"spam": "spam"})
47 for k in matches:
48 assert d.get(k) == matches[k]
49
50 for t in "%obxegfdDwWsS":
51 _(t, {"type": t})
52 _("10" + t, {"type": t, "width": "10"})
53 _("05d", {"type": "d", "width": "5", "zero": True})
54 _("<", {"align": "<"})
55 _(".<", {"align": "<", "fill": "."})
56 _(">", {"align": ">"})
57 _(".>", {"align": ">", "fill": "."})
58 _("^", {"align": "^"})
59 _(".^", {"align": "^", "fill": "."})
60 _("x=d", {"type": "d", "align": "=", "fill": "x"})
61 _("d", {"type": "d"})
62 _("ti", {"type": "ti"})
63 _("spam", {"type": "spam"})
64
65 _(".^010d", {"type": "d", "width": "10", "align": "^", "fill": ".", "zero": True})
66 _(".2f", {"type": "f", "precision": "2"})
67 _("10.2f", {"type": "f", "width": "10", "precision": "2"})
68
69
70def test_dot_separated_fields():

Callers

nothing calls this directly

Calls 1

_Function · 0.85

Tested by

no test coverage detected