def test_fmt_to_name(): eq_(au.fmt_to_name("{name}", {}), "name") eq_(au.fmt_to_name("{0}", {0: "name"}), "name") eq_(au.fmt_to_name("{1}", {0: "name"}), "1") assert_false(au.fmt_to_name("frontmatter{name}", {})) assert_false(au.fmt_to_name("{name}backmatter", {})) assert_false(au.fmt_to_name("{two}{names}", {})) assert_false(au.fmt_to_name("", {})) assert_false(au.fmt_to_name("nonames", {})) assert_false(au.fmt_to_name("{}", {}))