Skip to content

Commit 9723fff

Browse files
committed
Keep csv parity tests aligned with QUOTE_NONE support
Remove the stale RustPython expected-failure marker for the CPython escaped-field writer test that now passes, and cover CR/LF escaping in the snippet regression requested during review. Constraint: RustPython test policy allows removing expectedFailure markers only when the upstream test passes. Rejected: Refactoring writer row boilerplate in this follow-up | review marked it as a heavy-lift nitpick and it would broaden the CI fix. Confidence: high Scope-risk: narrow Tested: cargo run --release --features sqlite -- -m test test_csv; cargo run -- extra_tests/snippets/stdlib_csv.py; PATH=/tmp/pyshim:$PATH prek run --all-files; git diff --check; cargo test --workspace --exclude rustpython_wasm --exclude rustpython-venvlauncher; pytest -v in extra_tests Assisted-by: Codex:gpt-5.5
1 parent f29b7a3 commit 9723fff

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

Lib/test/test_csv.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,6 @@ class EscapedExcel(csv.excel):
854854
class TestEscapedExcel(TestCsvBase):
855855
dialect = EscapedExcel()
856856

857-
@unittest.expectedFailure # TODO: RUSTPYTHON
858857
def test_escape_fieldsep(self):
859858
self.writerAssertEqual([['abc,def']], 'abc\\,def\r\n')
860859

extra_tests/snippets/stdlib_csv.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ def test_quote_none_writer_without_quotechar():
101101
).writerow(["a\\b"])
102102
assert escapechar_buf.getvalue() == "a\\\\b\r\n"
103103

104+
linebreak_buf = io.StringIO()
105+
csv.writer(
106+
linebreak_buf,
107+
quoting=csv.QUOTE_NONE,
108+
quotechar=None,
109+
escapechar="\\",
110+
).writerow(["a\rb", "c\nd"])
111+
assert linebreak_buf.getvalue() == "a\\\rb,c\\\nd\r\n"
112+
104113
with assert_raises(csv.Error):
105114
csv.writer(io.StringIO(), quoting=csv.QUOTE_NONE, quotechar=None).writerow(
106115
["a,b"]

0 commit comments

Comments
 (0)