From ad6cc8f0a2f150d0239d40cec1ff4c5096270f55 Mon Sep 17 00:00:00 2001 From: Shahar Naveh <50263213+ShaharNaveh@users.noreply.github.com> Date: Mon, 11 May 2026 18:53:10 +0300 Subject: [PATCH] Update `test_csv.py` to 3.14.5 (#7831) * Update `test_csv.py` to 3.14.5 * Mark failing test --- Lib/test/test_csv.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py index 8af2f0b33..0e1f020d3 100644 --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -571,6 +571,34 @@ class Test_Csv(unittest.TestCase): self.assertEqual(row, rows[i]) + @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: Error not raised + def test_reader_reentrant_iterator(self): + # gh-145105: re-entering the reader from the iterator must not crash. + class ReentrantIter: + def __init__(self): + self.reader = None + self.n = 0 + def __iter__(self): + return self + def __next__(self): + self.n += 1 + if self.n == 1: + try: + next(self.reader) + except StopIteration: + pass + return "a,b" + if self.n == 2: + return "x" + raise StopIteration + + it = ReentrantIter() + reader = csv.reader(it) + it.reader = reader + with self.assertRaises(csv.Error): + next(reader) + + class TestDialectRegistry(unittest.TestCase): def test_registry_badargs(self): self.assertRaises(TypeError, csv.list_dialects, None)