MCPcopy Create free account
hub / github.com/astral-sh/ruff / quote

Function quote

crates/ruff_python_codegen/src/generator.rs:1935–1949  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1933
1934 #[test]
1935 fn quote() {
1936 assert_round_trip!(r#""hello""#);
1937 assert_round_trip!(r"'hello'");
1938 assert_round_trip!(r"u'hello'");
1939 assert_round_trip!(r"r'hello'");
1940 assert_round_trip!(r"b'hello'");
1941 assert_round_trip!(r#"b"hello""#);
1942 assert_round_trip!(r"f'hello'");
1943 assert_round_trip!(r#"f"hello""#);
1944 assert_eq!(round_trip(r#"("abc" "def" "ghi")"#), r#""abc" "def" "ghi""#);
1945 assert_eq!(round_trip(r#""he\"llo""#), r#"'he"llo'"#);
1946 assert_eq!(round_trip(r#"b"he\"llo""#), r#"b'he"llo'"#);
1947 assert_eq!(round_trip(r#"f"abc{'def'}{1}""#), r#"f"abc{'def'}{1}""#);
1948 assert_round_trip!(r#"f'abc{"def"}{1}'"#);
1949 }
1950
1951 /// test all of the valid string literal prefix and quote combinations from
1952 /// <https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected