diff options
author | Andrew McNamara <andrewm@object-craft.com.au> | 2005-01-11 01:28:33 (GMT) |
---|---|---|
committer | Andrew McNamara <andrewm@object-craft.com.au> | 2005-01-11 01:28:33 (GMT) |
commit | 86625972a1e330e200a3ae34f414a6caf12c6502 (patch) | |
tree | 7e00324cfda7ae054ba24b9cf246b0e0bd9284da /Lib/test/test_csv.py | |
parent | 91b97463cdbf9012a95633591545974a267a1ed7 (diff) | |
download | cpython-86625972a1e330e200a3ae34f414a6caf12c6502.zip cpython-86625972a1e330e200a3ae34f414a6caf12c6502.tar.gz cpython-86625972a1e330e200a3ae34f414a6caf12c6502.tar.bz2 |
Allow dialect-describing keywords to be supplied to register_dialect,
record objects of internal dialect type, rather than instances of
python objects.
Diffstat (limited to 'Lib/test/test_csv.py')
-rw-r--r-- | Lib/test/test_csv.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/test_csv.py b/Lib/test/test_csv.py index 66b0ea9..cdda179 100644 --- a/Lib/test/test_csv.py +++ b/Lib/test/test_csv.py @@ -272,13 +272,22 @@ class TestDialectRegistry(unittest.TestCase): expected_dialects.sort() csv.register_dialect(name, myexceltsv) try: - self.failUnless(isinstance(csv.get_dialect(name), myexceltsv)) + self.failUnless(csv.get_dialect(name).delimiter, '\t') got_dialects = csv.list_dialects() got_dialects.sort() self.assertEqual(expected_dialects, got_dialects) finally: csv.unregister_dialect(name) + def test_register_kwargs(self): + name = 'fedcba' + csv.register_dialect(name, delimiter=';') + try: + self.failUnless(csv.get_dialect(name).delimiter, '\t') + self.failUnless(list(csv.reader('X;Y;Z', name)), ['X', 'Y', 'Z']) + finally: + csv.unregister_dialect(name) + def test_incomplete_dialect(self): class myexceltsv(csv.Dialect): delimiter = "\t" |