🌐 AI搜索 & 代理 主页
Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changed tests to use check_disallow_instantiation, separated tests
  • Loading branch information
chgnrdv committed May 7, 2023
commit aa34fae64b55982bb0abb8a306f4075fe17292c1
16 changes: 10 additions & 6 deletions Lib/test/test_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import gc
import pickle
from test import support
from test.support import warnings_helper
from test.support import warnings_helper, check_disallow_instantiation
from itertools import permutations
from textwrap import dedent
from collections import OrderedDict
Expand Down Expand Up @@ -1431,13 +1431,17 @@ def test_subclassable(self):
# issue 44089
class Foo(csv.Error): ...

def test_issue104265(self):
with self.assertRaisesRegex(TypeError, "cannot create '_csv.reader' instances"):
_csv.Reader()
with self.assertRaisesRegex(TypeError, "cannot create '_csv.writer' instances"):
_csv.Writer()
def test_reader_disallow_instantiation(self):
check_disallow_instantiation(self, _csv.Reader)

def test_writer_disallow_instantiation(self):
check_disallow_instantiation(self, _csv.Writer)

def test_reader_not_basetype(self):
with self.assertRaisesRegex(TypeError, "type '_csv.reader' is not an acceptable base type"):
class Foo(_csv.Reader): pass

def test_writer_not_basetype(self):
with self.assertRaisesRegex(TypeError, "type '_csv.writer' is not an acceptable base type"):
class Foo(_csv.Writer): pass

Expand Down