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

Function test_parse_key

crates/common/src/cformat.rs:893–918  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

891
892 #[test]
893 fn test_parse_key() {
894 let expected = Ok(CFormatSpecKeyed {
895 mapping_key: Some("amount".to_owned()),
896 spec: CFormatSpec {
897 format_type: CFormatType::Number(CNumberType::DecimalD),
898 min_field_width: None,
899 precision: None,
900 flags: CConversionFlags::empty(),
901 },
902 });
903 assert_eq!("%(amount)d".parse::<CFormatSpecKeyed<String>>(), expected);
904
905 let expected = Ok(CFormatSpecKeyed {
906 mapping_key: Some("m((u(((l((((ti))))p)))l))e".to_owned()),
907 spec: CFormatSpec {
908 format_type: CFormatType::Number(CNumberType::DecimalD),
909 min_field_width: None,
910 precision: None,
911 flags: CConversionFlags::empty(),
912 },
913 });
914 assert_eq!(
915 "%(m((u(((l((((ti))))p)))l))e)d".parse::<CFormatSpecKeyed<String>>(),
916 expected
917 );
918 }
919
920 #[test]
921 fn test_format_parse_key_fail() {

Callers

nothing calls this directly

Calls 3

SomeClass · 0.50
NumberClass · 0.50
to_ownedMethod · 0.45

Tested by

no test coverage detected