Bug#1082096: FTBFS with Python 3.13
Stefano Rivera
stefanor at debian.org
Wed Sep 18 10:42:30 BST 2024
Source: pandas
Version: 2.2.2+dfsg-4
Severity: normal
User: debian-python at lists.debian.org
Usertags: python3.13
Forwarded: https://github.com/pandas-dev/pandas/issues/58734
This package failed build from source when test-built against a version of
python3-defaults that includes 3.13 as a supported version.
To reproduce this issue, build against python3-defaults (python3-all-dev etc.)
from Debian experimental.
What's new in Python 3.13:
https://docs.python.org/3.13/whatsnew/3.13.html
Log snippet:
pandas/tests/io/xml/test_to_xml.py ........................................................................s...............................................................ss
pandas/tests/io/xml/test_xml.py ..........................................................................FF.......s..........................................................................s......s......s......s......s......s......s......s......s......s......s......s...sss.sss.
pandas/tests/io/xml/test_xml_dtypes.py ..............................................
=================================== FAILURES ===================================
_________ test_dialect_conflict_except_delimiter[c_high-dialect-None] __________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff63457de0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = None, value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[c_high-dialect-doublequote] ______
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff63457ed0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'doublequote', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[c_high-dialect-escapechar] _______
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff7478eee0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'escapechar', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
___ test_dialect_conflict_except_delimiter[c_high-dialect-skipinitialspace] ____
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff7478de50>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'skipinitialspace', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[c_high-dialect-quotechar] _______
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff7478dfe0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quotechar', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[c_high-dialect-quoting] ________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff7478eb20>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quoting', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_except_delimiter[c_high-default-None] __________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff7478f160>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = None, value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[c_high-default-doublequote] ______
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74798c80>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'doublequote', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[c_high-default-escapechar] _______
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74798c30>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'escapechar', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
___ test_dialect_conflict_except_delimiter[c_high-default-skipinitialspace] ____
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74798190>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'skipinitialspace', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[c_high-default-quotechar] _______
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff747985a0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quotechar', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[c_high-default-quoting] ________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74798b90>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quoting', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_except_delimiter[c_high-other-None] ___________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74799c70>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = None, value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[c_high-other-doublequote] _______
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff7479b700>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'doublequote', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[c_high-other-escapechar] ________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff747614a0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'escapechar', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
____ test_dialect_conflict_except_delimiter[c_high-other-skipinitialspace] _____
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74760a50>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'skipinitialspace', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[c_high-other-quotechar] ________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74760280>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quotechar', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_except_delimiter[c_high-other-quoting] _________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74760550>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quoting', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_except_delimiter[c_low-dialect-None] __________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74760960>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = None, value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[c_low-dialect-doublequote] _______
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74760f50>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'doublequote', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[c_low-dialect-escapechar] _______
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff747628a0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'escapechar', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
____ test_dialect_conflict_except_delimiter[c_low-dialect-skipinitialspace] ____
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74763020>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'skipinitialspace', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[c_low-dialect-quotechar] ________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff746cff70>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quotechar', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[c_low-dialect-quoting] _________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff746cc820>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quoting', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_except_delimiter[c_low-default-None] __________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff746cfa70>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = None, value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[c_low-default-doublequote] _______
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff746cfc50>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'doublequote', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[c_low-default-escapechar] _______
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff746cc4b0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'escapechar', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
____ test_dialect_conflict_except_delimiter[c_low-default-skipinitialspace] ____
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff746cd590>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'skipinitialspace', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[c_low-default-quotechar] ________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff746cf070>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quotechar', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[c_low-default-quoting] _________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff746cf890>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quoting', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
___________ test_dialect_conflict_except_delimiter[c_low-other-None] ___________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74730c30>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = None, value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[c_low-other-doublequote] ________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74733c00>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'doublequote', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[c_low-other-escapechar] ________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74733ac0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'escapechar', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_____ test_dialect_conflict_except_delimiter[c_low-other-skipinitialspace] _____
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74730050>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'skipinitialspace', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[c_low-other-quotechar] _________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74730a50>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quotechar', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_except_delimiter[c_low-other-quoting] __________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74732530>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quoting', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_except_delimiter[python-dialect-None] __________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff74732c60>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = None, value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[python-dialect-doublequote] ______
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff7471cc80>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'doublequote', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[python-dialect-escapechar] _______
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff7471c780>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'escapechar', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
___ test_dialect_conflict_except_delimiter[python-dialect-skipinitialspace] ____
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff7471c0f0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'skipinitialspace', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[python-dialect-quotechar] _______
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff7471c550>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quotechar', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[python-dialect-quoting] ________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff7471cf50>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quoting', value = 'dialect'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_except_delimiter[python-default-None] __________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff7471e580>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = None, value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[python-default-doublequote] ______
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff7471fca0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'doublequote', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
______ test_dialect_conflict_except_delimiter[python-default-escapechar] _______
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff74104050>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'escapechar', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
___ test_dialect_conflict_except_delimiter[python-default-skipinitialspace] ____
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff74104190>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'skipinitialspace', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[python-default-quotechar] _______
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff741044b0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quotechar', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[python-default-quoting] ________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff741047d0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quoting', value = 'default'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_except_delimiter[python-other-None] ___________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff74104e10>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = None, value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[python-other-doublequote] _______
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff74105bd0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'doublequote', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_______ test_dialect_conflict_except_delimiter[python-other-escapechar] ________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff74107610>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'escapechar', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
____ test_dialect_conflict_except_delimiter[python-other-skipinitialspace] _____
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff74107cf0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'skipinitialspace', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_except_delimiter[python-other-quotechar] ________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff740f0960>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quotechar', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_except_delimiter[python-other-quoting] _________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff740f0230>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
arg = 'quoting', value = 'other'
@pytest.mark.parametrize(
"arg",
[None, "doublequote", "escapechar", "skipinitialspace", "quotechar", "quoting"],
)
@pytest.mark.parametrize("value", ["dialect", "default", "other"])
def test_dialect_conflict_except_delimiter(all_parsers, custom_dialect, arg, value):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
warning_klass = None
kwds = {}
# arg=None tests when we pass in the dialect without any other arguments.
if arg is not None:
if value == "dialect": # No conflict --> no warning.
kwds[arg] = dialect_kwargs[arg]
elif value == "default": # Default --> no warning.
from pandas.io.parsers.base_parser import parser_defaults
kwds[arg] = parser_defaults[arg]
else: # Non-default + conflict with dialect --> warning.
warning_klass = ParserWarning
kwds[arg] = "blah"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:125:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_delimiter[c_high-sep-override-true] ___________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff740f1fe0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'sep': ','}, warning_klass = None
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_delimiter[c_high-sep-override-false] __________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff741545a0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'sep': '.'}, warning_klass = <class 'pandas.errors.ParserWarning'>
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_delimiter[c_high-delimiter-no-conflict] _________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74154230>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': ':'}, warning_klass = None
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_delimiter[c_high-delimiter-default-arg] _________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74154be0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': None}, warning_klass = None
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_delimiter[c_high-delimiter-conflict] __________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74156a30>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': ','}
warning_klass = <class 'pandas.errors.ParserWarning'>
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_delimiter[c_high-delimiter-conflict2] __________
all_parsers = <pandas.tests.io.parser.conftest.CParserHighMemory object at 0xffff74157430>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': '.'}
warning_klass = <class 'pandas.errors.ParserWarning'>
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
___________ test_dialect_conflict_delimiter[c_low-sep-override-true] ___________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff741566c0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'sep': ','}, warning_klass = None
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_delimiter[c_low-sep-override-false] ___________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff74156f30>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'sep': '.'}, warning_klass = <class 'pandas.errors.ParserWarning'>
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_delimiter[c_low-delimiter-no-conflict] _________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff748dcb90>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': ':'}, warning_klass = None
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_delimiter[c_low-delimiter-default-arg] _________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff748dda90>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': None}, warning_klass = None
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_delimiter[c_low-delimiter-conflict] ___________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff748dc050>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': ','}
warning_klass = <class 'pandas.errors.ParserWarning'>
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_delimiter[c_low-delimiter-conflict2] __________
all_parsers = <pandas.tests.io.parser.conftest.CParserLowMemory object at 0xffff748de0d0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': '.'}
warning_klass = <class 'pandas.errors.ParserWarning'>
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_delimiter[python-sep-override-true] ___________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff748dcb40>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'sep': ','}, warning_klass = None
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_delimiter[python-sep-override-false] __________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff748ddfe0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'sep': '.'}, warning_klass = <class 'pandas.errors.ParserWarning'>
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_delimiter[python-delimiter-no-conflict] _________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff748dde00>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': ':'}, warning_klass = None
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
________ test_dialect_conflict_delimiter[python-delimiter-default-arg] _________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff740ce530>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': None}, warning_klass = None
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
__________ test_dialect_conflict_delimiter[python-delimiter-conflict] __________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff745f67b0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': ','}
warning_klass = <class 'pandas.errors.ParserWarning'>
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
_________ test_dialect_conflict_delimiter[python-delimiter-conflict2] __________
all_parsers = <pandas.tests.io.parser.conftest.PythonParser object at 0xffff634856d0>
custom_dialect = ('weird', {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...})
kwargs = {'delimiter': '.'}
warning_klass = <class 'pandas.errors.ParserWarning'>
@pytest.mark.parametrize(
"kwargs,warning_klass",
[
({"sep": ","}, None), # sep is default --> sep_override=True
({"sep": "."}, ParserWarning), # sep isn't default --> sep_override=False
({"delimiter": ":"}, None), # No conflict
({"delimiter": None}, None), # Default arguments --> sep_override=True
({"delimiter": ","}, ParserWarning), # Conflict
({"delimiter": "."}, ParserWarning), # Conflict
],
ids=[
"sep-override-true",
"sep-override-false",
"delimiter-no-conflict",
"delimiter-default-arg",
"delimiter-conflict",
"delimiter-conflict2",
],
)
def test_dialect_conflict_delimiter(all_parsers, custom_dialect, kwargs, warning_klass):
# see gh-23761.
dialect_name, dialect_kwargs = custom_dialect
parser = all_parsers
expected = DataFrame({"a": [1], "b": [2]})
data = "a:b\n1:2"
> with tm.with_csv_dialect(dialect_name, **dialect_kwargs):
pandas/tests/io/parser/test_dialect.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.13/contextlib.py:141: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
name = 'weird'
kwargs = {'delimiter': ':', 'doublequote': False, 'escapechar': '~', 'quotechar': '~', ...}
csv = <module 'csv' from '/usr/lib/python3.13/csv.py'>
_BUILTIN_DIALECTS = {'excel', 'excel-tab', 'unix'}
@contextmanager
def with_csv_dialect(name: str, **kwargs) -> Generator[None, None, None]:
"""
Context manager to temporarily register a CSV dialect for parsing CSV.
Parameters
----------
name : str
The name of the dialect.
kwargs : mapping
The parameters for the dialect.
Raises
------
ValueError : the name of the dialect conflicts with a builtin one.
See Also
--------
csv : Python's CSV library.
"""
import csv
_BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
if name in _BUILTIN_DIALECTS:
raise ValueError("Cannot override builtin dialect.")
> csv.register_dialect(name, **kwargs)
E ValueError: bad escapechar or quotechar value
pandas/_testing/contexts.py:173: ValueError
___________ TestMMapWrapper.test_warning_missing_utf_bom[bz2-utf-16] ___________
self = <pandas.tests.io.test_common.TestMMapWrapper object at 0xffff944d8cb0>
encoding = 'utf-16', compression_ = 'bz2'
@pytest.mark.parametrize("encoding", ["utf-16", "utf-32"])
@pytest.mark.parametrize("compression_", ["bz2", "xz"])
def test_warning_missing_utf_bom(self, encoding, compression_):
"""
bz2 and xz do not write the byte order mark (BOM) for utf-16/32.
https://stackoverflow.com/questions/55171439
GH 35681
"""
df = pd.DataFrame(
1.1 * np.arange(120).reshape((30, 4)),
columns=pd.Index(list("ABCD"), dtype=object),
index=pd.Index([f"i-{i}" for i in range(30)], dtype=object),
)
with tm.ensure_clean() as path:
with tm.assert_produces_warning(UnicodeWarning):
df.to_csv(path, compression=compression_, encoding=encoding)
# reading should fail (otherwise we wouldn't need the warning)
msg = r"UTF-\d+ stream does not start with BOM"
with pytest.raises(UnicodeError, match=msg):
> pd.read_csv(path, compression=compression_, encoding=encoding)
pandas/tests/io/test_common.py:490:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/io/parsers/readers.py:1026: in read_csv
return _read(filepath_or_buffer, kwds)
pandas/io/parsers/readers.py:620: in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
pandas/io/parsers/readers.py:1620: in __init__
self._engine = self._make_engine(f, self.engine)
pandas/io/parsers/readers.py:1898: in _make_engine
return mapping[engine](f, **self.options)
pandas/io/parsers/c_parser_wrapper.py:93: in __init__
self._reader = parsers.TextReader(src, **kwds)
pandas/_libs/parsers.pyx:574: in pandas._libs.parsers.TextReader.__cinit__
header, table_width, unnamed_cols = self._get_header(prelim_header)
pandas/_libs/parsers.pyx:663: in pandas._libs.parsers.TextReader._get_header
self._tokenize_rows(hr + 2)
pandas/_libs/parsers.pyx:874: in pandas._libs.parsers.TextReader._tokenize_rows
self._check_tokenize_status(status)
pandas/_libs/parsers.pyx:891: in pandas._libs.parsers.TextReader._check_tokenize_status
raise_parser_error("Error tokenizing data", self.parser)
pandas/_libs/parsers.pyx:2053: in pandas._libs.parsers.raise_parser_error
raise old_exc
<frozen codecs>:325: in decode
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <encodings.utf_16.IncrementalDecoder object at 0xffff62e84ad0>
input = b',\x00A\x00,\x00B\x00,\x00C\x00,\x00D\x00\n\x00i\x00-\x000\x00,\x000\x00.\x000\x00,\x001\x00.\x001\x00,\x002\x00.\x00...000\x000\x000\x000\x000\x000\x000\x000\x000\x002\x00,\x001\x002\x009\x00.\x008\x00,\x001\x003\x000\x00.\x009\x00\n\x00'
errors = 'strict', final = False
def _buffer_decode(self, input, errors, final):
if self.decoder is None:
(output, consumed, byteorder) = \
codecs.utf_16_ex_decode(input, errors, 0, final)
if byteorder == -1:
self.decoder = codecs.utf_16_le_decode
elif byteorder == 1:
self.decoder = codecs.utf_16_be_decode
elif consumed >= 2:
> raise UnicodeDecodeError("utf-16", input, 0, 2, "Stream does not start with BOM")
E UnicodeDecodeError: 'utf-16' codec can't decode bytes in position 0-1: Stream does not start with BOM
/usr/lib/python3.13/encodings/utf_16.py:67: UnicodeDecodeError
During handling of the above exception, another exception occurred:
self = <pandas.tests.io.test_common.TestMMapWrapper object at 0xffff944d8cb0>
encoding = 'utf-16', compression_ = 'bz2'
@pytest.mark.parametrize("encoding", ["utf-16", "utf-32"])
@pytest.mark.parametrize("compression_", ["bz2", "xz"])
def test_warning_missing_utf_bom(self, encoding, compression_):
"""
bz2 and xz do not write the byte order mark (BOM) for utf-16/32.
https://stackoverflow.com/questions/55171439
GH 35681
"""
df = pd.DataFrame(
1.1 * np.arange(120).reshape((30, 4)),
columns=pd.Index(list("ABCD"), dtype=object),
index=pd.Index([f"i-{i}" for i in range(30)], dtype=object),
)
with tm.ensure_clean() as path:
with tm.assert_produces_warning(UnicodeWarning):
df.to_csv(path, compression=compression_, encoding=encoding)
# reading should fail (otherwise we wouldn't need the warning)
msg = r"UTF-\d+ stream does not start with BOM"
> with pytest.raises(UnicodeError, match=msg):
E AssertionError: Regex pattern did not match.
E Regex: 'UTF-\\d+ stream does not start with BOM'
E Input: "'utf-16' codec can't decode bytes in position 0-1: Stream does not start with BOM"
pandas/tests/io/test_common.py:489: AssertionError
___________ TestMMapWrapper.test_warning_missing_utf_bom[bz2-utf-32] ___________
self = <pandas.tests.io.test_common.TestMMapWrapper object at 0xffff95e92ad0>
encoding = 'utf-32', compression_ = 'bz2'
@pytest.mark.parametrize("encoding", ["utf-16", "utf-32"])
@pytest.mark.parametrize("compression_", ["bz2", "xz"])
def test_warning_missing_utf_bom(self, encoding, compression_):
"""
bz2 and xz do not write the byte order mark (BOM) for utf-16/32.
https://stackoverflow.com/questions/55171439
GH 35681
"""
df = pd.DataFrame(
1.1 * np.arange(120).reshape((30, 4)),
columns=pd.Index(list("ABCD"), dtype=object),
index=pd.Index([f"i-{i}" for i in range(30)], dtype=object),
)
with tm.ensure_clean() as path:
with tm.assert_produces_warning(UnicodeWarning):
df.to_csv(path, compression=compression_, encoding=encoding)
# reading should fail (otherwise we wouldn't need the warning)
msg = r"UTF-\d+ stream does not start with BOM"
with pytest.raises(UnicodeError, match=msg):
> pd.read_csv(path, compression=compression_, encoding=encoding)
pandas/tests/io/test_common.py:490:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/io/parsers/readers.py:1026: in read_csv
return _read(filepath_or_buffer, kwds)
pandas/io/parsers/readers.py:620: in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
pandas/io/parsers/readers.py:1620: in __init__
self._engine = self._make_engine(f, self.engine)
pandas/io/parsers/readers.py:1898: in _make_engine
return mapping[engine](f, **self.options)
pandas/io/parsers/c_parser_wrapper.py:93: in __init__
self._reader = parsers.TextReader(src, **kwds)
pandas/_libs/parsers.pyx:574: in pandas._libs.parsers.TextReader.__cinit__
header, table_width, unnamed_cols = self._get_header(prelim_header)
pandas/_libs/parsers.pyx:663: in pandas._libs.parsers.TextReader._get_header
self._tokenize_rows(hr + 2)
pandas/_libs/parsers.pyx:874: in pandas._libs.parsers.TextReader._tokenize_rows
self._check_tokenize_status(status)
pandas/_libs/parsers.pyx:891: in pandas._libs.parsers.TextReader._check_tokenize_status
raise_parser_error("Error tokenizing data", self.parser)
pandas/_libs/parsers.pyx:2053: in pandas._libs.parsers.raise_parser_error
raise old_exc
<frozen codecs>:325: in decode
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <encodings.utf_32.IncrementalDecoder object at 0xffff62e845f0>
input = b',\x00\x00\x00A\x00\x00\x00,\x00\x00\x00B\x00\x00\x00,\x00\x00\x00C\x00\x00\x00,\x00\x00\x00D\x00\x00\x00\n\x00\x00\x....\x00\x00\x008\x00\x00\x00,\x00\x00\x001\x00\x00\x003\x00\x00\x000\x00\x00\x00.\x00\x00\x009\x00\x00\x00\n\x00\x00\x00'
errors = 'strict', final = False
def _buffer_decode(self, input, errors, final):
if self.decoder is None:
(output, consumed, byteorder) = \
codecs.utf_32_ex_decode(input, errors, 0, final)
if byteorder == -1:
self.decoder = codecs.utf_32_le_decode
elif byteorder == 1:
self.decoder = codecs.utf_32_be_decode
elif consumed >= 4:
> raise UnicodeDecodeError("utf-32", input, 0, 4, "Stream does not start with BOM")
E UnicodeDecodeError: 'utf-32' codec can't decode bytes in position 0-3: Stream does not start with BOM
/usr/lib/python3.13/encodings/utf_32.py:62: UnicodeDecodeError
During handling of the above exception, another exception occurred:
self = <pandas.tests.io.test_common.TestMMapWrapper object at 0xffff95e92ad0>
encoding = 'utf-32', compression_ = 'bz2'
@pytest.mark.parametrize("encoding", ["utf-16", "utf-32"])
@pytest.mark.parametrize("compression_", ["bz2", "xz"])
def test_warning_missing_utf_bom(self, encoding, compression_):
"""
bz2 and xz do not write the byte order mark (BOM) for utf-16/32.
https://stackoverflow.com/questions/55171439
GH 35681
"""
df = pd.DataFrame(
1.1 * np.arange(120).reshape((30, 4)),
columns=pd.Index(list("ABCD"), dtype=object),
index=pd.Index([f"i-{i}" for i in range(30)], dtype=object),
)
with tm.ensure_clean() as path:
with tm.assert_produces_warning(UnicodeWarning):
df.to_csv(path, compression=compression_, encoding=encoding)
# reading should fail (otherwise we wouldn't need the warning)
msg = r"UTF-\d+ stream does not start with BOM"
> with pytest.raises(UnicodeError, match=msg):
E AssertionError: Regex pattern did not match.
E Regex: 'UTF-\\d+ stream does not start with BOM'
E Input: "'utf-32' codec can't decode bytes in position 0-3: Stream does not start with BOM"
pandas/tests/io/test_common.py:489: AssertionError
___________ TestMMapWrapper.test_warning_missing_utf_bom[xz-utf-16] ____________
self = <pandas.tests.io.test_common.TestMMapWrapper object at 0xffff95e929c0>
encoding = 'utf-16', compression_ = 'xz'
@pytest.mark.parametrize("encoding", ["utf-16", "utf-32"])
@pytest.mark.parametrize("compression_", ["bz2", "xz"])
def test_warning_missing_utf_bom(self, encoding, compression_):
"""
bz2 and xz do not write the byte order mark (BOM) for utf-16/32.
https://stackoverflow.com/questions/55171439
GH 35681
"""
df = pd.DataFrame(
1.1 * np.arange(120).reshape((30, 4)),
columns=pd.Index(list("ABCD"), dtype=object),
index=pd.Index([f"i-{i}" for i in range(30)], dtype=object),
)
with tm.ensure_clean() as path:
with tm.assert_produces_warning(UnicodeWarning):
df.to_csv(path, compression=compression_, encoding=encoding)
# reading should fail (otherwise we wouldn't need the warning)
msg = r"UTF-\d+ stream does not start with BOM"
with pytest.raises(UnicodeError, match=msg):
> pd.read_csv(path, compression=compression_, encoding=encoding)
pandas/tests/io/test_common.py:490:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/io/parsers/readers.py:1026: in read_csv
return _read(filepath_or_buffer, kwds)
pandas/io/parsers/readers.py:620: in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
pandas/io/parsers/readers.py:1620: in __init__
self._engine = self._make_engine(f, self.engine)
pandas/io/parsers/readers.py:1898: in _make_engine
return mapping[engine](f, **self.options)
pandas/io/parsers/c_parser_wrapper.py:93: in __init__
self._reader = parsers.TextReader(src, **kwds)
pandas/_libs/parsers.pyx:574: in pandas._libs.parsers.TextReader.__cinit__
header, table_width, unnamed_cols = self._get_header(prelim_header)
pandas/_libs/parsers.pyx:663: in pandas._libs.parsers.TextReader._get_header
self._tokenize_rows(hr + 2)
pandas/_libs/parsers.pyx:874: in pandas._libs.parsers.TextReader._tokenize_rows
self._check_tokenize_status(status)
pandas/_libs/parsers.pyx:891: in pandas._libs.parsers.TextReader._check_tokenize_status
raise_parser_error("Error tokenizing data", self.parser)
pandas/_libs/parsers.pyx:2053: in pandas._libs.parsers.raise_parser_error
raise old_exc
<frozen codecs>:325: in decode
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <encodings.utf_16.IncrementalDecoder object at 0xffff62b3bc50>
input = b',\x00A\x00,\x00B\x00,\x00C\x00,\x00D\x00\n\x00i\x00-\x000\x00,\x000\x00.\x000\x00,\x001\x00.\x001\x00,\x002\x00.\x00...000\x000\x000\x000\x000\x000\x000\x000\x000\x002\x00,\x001\x002\x009\x00.\x008\x00,\x001\x003\x000\x00.\x009\x00\n\x00'
errors = 'strict', final = False
def _buffer_decode(self, input, errors, final):
if self.decoder is None:
(output, consumed, byteorder) = \
codecs.utf_16_ex_decode(input, errors, 0, final)
if byteorder == -1:
self.decoder = codecs.utf_16_le_decode
elif byteorder == 1:
self.decoder = codecs.utf_16_be_decode
elif consumed >= 2:
> raise UnicodeDecodeError("utf-16", input, 0, 2, "Stream does not start with BOM")
E UnicodeDecodeError: 'utf-16' codec can't decode bytes in position 0-1: Stream does not start with BOM
/usr/lib/python3.13/encodings/utf_16.py:67: UnicodeDecodeError
During handling of the above exception, another exception occurred:
self = <pandas.tests.io.test_common.TestMMapWrapper object at 0xffff95e929c0>
encoding = 'utf-16', compression_ = 'xz'
@pytest.mark.parametrize("encoding", ["utf-16", "utf-32"])
@pytest.mark.parametrize("compression_", ["bz2", "xz"])
def test_warning_missing_utf_bom(self, encoding, compression_):
"""
bz2 and xz do not write the byte order mark (BOM) for utf-16/32.
https://stackoverflow.com/questions/55171439
GH 35681
"""
df = pd.DataFrame(
1.1 * np.arange(120).reshape((30, 4)),
columns=pd.Index(list("ABCD"), dtype=object),
index=pd.Index([f"i-{i}" for i in range(30)], dtype=object),
)
with tm.ensure_clean() as path:
with tm.assert_produces_warning(UnicodeWarning):
df.to_csv(path, compression=compression_, encoding=encoding)
# reading should fail (otherwise we wouldn't need the warning)
msg = r"UTF-\d+ stream does not start with BOM"
> with pytest.raises(UnicodeError, match=msg):
E AssertionError: Regex pattern did not match.
E Regex: 'UTF-\\d+ stream does not start with BOM'
E Input: "'utf-16' codec can't decode bytes in position 0-1: Stream does not start with BOM"
pandas/tests/io/test_common.py:489: AssertionError
___________ TestMMapWrapper.test_warning_missing_utf_bom[xz-utf-32] ____________
self = <pandas.tests.io.test_common.TestMMapWrapper object at 0xffff9451a450>
encoding = 'utf-32', compression_ = 'xz'
@pytest.mark.parametrize("encoding", ["utf-16", "utf-32"])
@pytest.mark.parametrize("compression_", ["bz2", "xz"])
def test_warning_missing_utf_bom(self, encoding, compression_):
"""
bz2 and xz do not write the byte order mark (BOM) for utf-16/32.
https://stackoverflow.com/questions/55171439
GH 35681
"""
df = pd.DataFrame(
1.1 * np.arange(120).reshape((30, 4)),
columns=pd.Index(list("ABCD"), dtype=object),
index=pd.Index([f"i-{i}" for i in range(30)], dtype=object),
)
with tm.ensure_clean() as path:
with tm.assert_produces_warning(UnicodeWarning):
df.to_csv(path, compression=compression_, encoding=encoding)
# reading should fail (otherwise we wouldn't need the warning)
msg = r"UTF-\d+ stream does not start with BOM"
with pytest.raises(UnicodeError, match=msg):
> pd.read_csv(path, compression=compression_, encoding=encoding)
pandas/tests/io/test_common.py:490:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/io/parsers/readers.py:1026: in read_csv
return _read(filepath_or_buffer, kwds)
pandas/io/parsers/readers.py:620: in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
pandas/io/parsers/readers.py:1620: in __init__
self._engine = self._make_engine(f, self.engine)
pandas/io/parsers/readers.py:1898: in _make_engine
return mapping[engine](f, **self.options)
pandas/io/parsers/c_parser_wrapper.py:93: in __init__
self._reader = parsers.TextReader(src, **kwds)
pandas/_libs/parsers.pyx:574: in pandas._libs.parsers.TextReader.__cinit__
header, table_width, unnamed_cols = self._get_header(prelim_header)
pandas/_libs/parsers.pyx:663: in pandas._libs.parsers.TextReader._get_header
self._tokenize_rows(hr + 2)
pandas/_libs/parsers.pyx:874: in pandas._libs.parsers.TextReader._tokenize_rows
self._check_tokenize_status(status)
pandas/_libs/parsers.pyx:891: in pandas._libs.parsers.TextReader._check_tokenize_status
raise_parser_error("Error tokenizing data", self.parser)
pandas/_libs/parsers.pyx:2053: in pandas._libs.parsers.raise_parser_error
raise old_exc
<frozen codecs>:325: in decode
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <encodings.utf_32.IncrementalDecoder object at 0xffff63235d30>
input = b',\x00\x00\x00A\x00\x00\x00,\x00\x00\x00B\x00\x00\x00,\x00\x00\x00C\x00\x00\x00,\x00\x00\x00D\x00\x00\x00\n\x00\x00\x....\x00\x00\x008\x00\x00\x00,\x00\x00\x001\x00\x00\x003\x00\x00\x000\x00\x00\x00.\x00\x00\x009\x00\x00\x00\n\x00\x00\x00'
errors = 'strict', final = False
def _buffer_decode(self, input, errors, final):
if self.decoder is None:
(output, consumed, byteorder) = \
codecs.utf_32_ex_decode(input, errors, 0, final)
if byteorder == -1:
self.decoder = codecs.utf_32_le_decode
elif byteorder == 1:
self.decoder = codecs.utf_32_be_decode
elif consumed >= 4:
> raise UnicodeDecodeError("utf-32", input, 0, 4, "Stream does not start with BOM")
E UnicodeDecodeError: 'utf-32' codec can't decode bytes in position 0-3: Stream does not start with BOM
/usr/lib/python3.13/encodings/utf_32.py:62: UnicodeDecodeError
During handling of the above exception, another exception occurred:
self = <pandas.tests.io.test_common.TestMMapWrapper object at 0xffff9451a450>
encoding = 'utf-32', compression_ = 'xz'
@pytest.mark.parametrize("encoding", ["utf-16", "utf-32"])
@pytest.mark.parametrize("compression_", ["bz2", "xz"])
def test_warning_missing_utf_bom(self, encoding, compression_):
"""
bz2 and xz do not write the byte order mark (BOM) for utf-16/32.
https://stackoverflow.com/questions/55171439
GH 35681
"""
df = pd.DataFrame(
1.1 * np.arange(120).reshape((30, 4)),
columns=pd.Index(list("ABCD"), dtype=object),
index=pd.Index([f"i-{i}" for i in range(30)], dtype=object),
)
with tm.ensure_clean() as path:
with tm.assert_produces_warning(UnicodeWarning):
df.to_csv(path, compression=compression_, encoding=encoding)
# reading should fail (otherwise we wouldn't need the warning)
msg = r"UTF-\d+ stream does not start with BOM"
> with pytest.raises(UnicodeError, match=msg):
E AssertionError: Regex pattern did not match.
E Regex: 'UTF-\\d+ stream does not start with BOM'
E Input: "'utf-32' codec can't decode bytes in position 0-3: Stream does not start with BOM"
pandas/tests/io/test_common.py:489: AssertionError
__________________________ test_utf16_encoding[lxml] ___________________________
xml_baby_names = '/<<PKGBUILDDIR>>/pandas/tests/io/data/xml/baby_names.xml'
parser = 'lxml'
def test_utf16_encoding(xml_baby_names, parser):
with pytest.raises(
UnicodeError,
match=(
"UTF-16 stream does not start with BOM|"
"'utf-16-le' codec can't decode byte"
),
):
> read_xml(xml_baby_names, encoding="UTF-16", parser=parser)
pandas/tests/io/xml/test_xml.py:1050:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/io/xml.py:1160: in read_xml
return _parse(
pandas/io/xml.py:852: in _parse
data_dicts = p.parse_data()
pandas/io/xml.py:556: in parse_data
self.xml_doc = self._parse_doc(self.path_or_buffer)
pandas/io/xml.py:631: in _parse_doc
handle_data = get_data_from_filepath(
pandas/io/xml.py:708: in get_data_from_filepath
handle_obj.handle.read()
<frozen codecs>:325: in decode
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <encodings.utf_16.IncrementalDecoder object at 0xffff60756930>
input = b'<?xml version="1.0" encoding="ISO-8859-1"?>\n<data>\n <row>\n <rank>1</rank>\n <malename>Jos\xe9</malename>\n...k>10</rank>\n <malename>Sebasti\xe1n</malename>\n <femalename>Mar\xeda Jos\xe9</femalename>\n </row>\n</data>\n'
errors = 'strict', final = True
def _buffer_decode(self, input, errors, final):
if self.decoder is None:
(output, consumed, byteorder) = \
codecs.utf_16_ex_decode(input, errors, 0, final)
if byteorder == -1:
self.decoder = codecs.utf_16_le_decode
elif byteorder == 1:
self.decoder = codecs.utf_16_be_decode
elif consumed >= 2:
> raise UnicodeDecodeError("utf-16", input, 0, 2, "Stream does not start with BOM")
E UnicodeDecodeError: 'utf-16' codec can't decode bytes in position 0-1: Stream does not start with BOM
/usr/lib/python3.13/encodings/utf_16.py:67: UnicodeDecodeError
During handling of the above exception, another exception occurred:
xml_baby_names = '/<<PKGBUILDDIR>>/pandas/tests/io/data/xml/baby_names.xml'
parser = 'lxml'
def test_utf16_encoding(xml_baby_names, parser):
> with pytest.raises(
UnicodeError,
match=(
"UTF-16 stream does not start with BOM|"
"'utf-16-le' codec can't decode byte"
),
):
E AssertionError: Regex pattern did not match.
E Regex: "UTF-16 stream does not start with BOM|'utf-16-le' codec can't decode byte"
E Input: "'utf-16' codec can't decode bytes in position 0-1: Stream does not start with BOM"
pandas/tests/io/xml/test_xml.py:1043: AssertionError
__________________________ test_utf16_encoding[etree] __________________________
xml_baby_names = '/<<PKGBUILDDIR>>/pandas/tests/io/data/xml/baby_names.xml'
parser = 'etree'
def test_utf16_encoding(xml_baby_names, parser):
with pytest.raises(
UnicodeError,
match=(
"UTF-16 stream does not start with BOM|"
"'utf-16-le' codec can't decode byte"
),
):
> read_xml(xml_baby_names, encoding="UTF-16", parser=parser)
pandas/tests/io/xml/test_xml.py:1050:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pandas/io/xml.py:1160: in read_xml
return _parse(
pandas/io/xml.py:852: in _parse
data_dicts = p.parse_data()
pandas/io/xml.py:442: in parse_data
self.xml_doc = self._parse_doc(self.path_or_buffer)
pandas/io/xml.py:524: in _parse_doc
handle_data = get_data_from_filepath(
pandas/io/xml.py:708: in get_data_from_filepath
handle_obj.handle.read()
<frozen codecs>:325: in decode
???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <encodings.utf_16.IncrementalDecoder object at 0xffff6052c1d0>
input = b'<?xml version="1.0" encoding="ISO-8859-1"?>\n<data>\n <row>\n <rank>1</rank>\n <malename>Jos\xe9</malename>\n...k>10</rank>\n <malename>Sebasti\xe1n</malename>\n <femalename>Mar\xeda Jos\xe9</femalename>\n </row>\n</data>\n'
errors = 'strict', final = True
def _buffer_decode(self, input, errors, final):
if self.decoder is None:
(output, consumed, byteorder) = \
codecs.utf_16_ex_decode(input, errors, 0, final)
if byteorder == -1:
self.decoder = codecs.utf_16_le_decode
elif byteorder == 1:
self.decoder = codecs.utf_16_be_decode
elif consumed >= 2:
> raise UnicodeDecodeError("utf-16", input, 0, 2, "Stream does not start with BOM")
E UnicodeDecodeError: 'utf-16' codec can't decode bytes in position 0-1: Stream does not start with BOM
/usr/lib/python3.13/encodings/utf_16.py:67: UnicodeDecodeError
During handling of the above exception, another exception occurred:
xml_baby_names = '/<<PKGBUILDDIR>>/pandas/tests/io/data/xml/baby_names.xml'
parser = 'etree'
def test_utf16_encoding(xml_baby_names, parser):
> with pytest.raises(
UnicodeError,
match=(
"UTF-16 stream does not start with BOM|"
"'utf-16-le' codec can't decode byte"
),
):
E AssertionError: Regex pattern did not match.
E Regex: "UTF-16 stream does not start with BOM|'utf-16-le' codec can't decode byte"
E Input: "'utf-16' codec can't decode bytes in position 0-1: Stream does not start with BOM"
pandas/tests/io/xml/test_xml.py:1043: AssertionError
- generated xml file: /<<PKGBUILDDIR>>/.pybuild/cpython3_3.13/build/test-data.xml -
============================= slowest 30 durations =============================
1.03s call pandas/tests/io/pytables/test_store.py::test_no_track_times
0.99s call pandas/tests/io/test_pickle.py::test_pickle_big_dataframe_compression[gzip-5]
0.99s call pandas/tests/io/test_pickle.py::test_pickle_big_dataframe_compression[gzip-4]
0.78s call pandas/tests/io/pytables/test_select.py::test_select_iterator_complete_8014
0.65s call pandas/tests/io/sas/test_byteswap.py::test_int_byteswap[True-uint16]
0.63s call pandas/tests/io/sas/test_byteswap.py::test_int_byteswap[False-uint64]
0.56s call pandas/tests/io/xml/test_xml.py::test_dtd[etree]
0.54s call pandas/tests/io/test_html.py::TestReadHtml::test_string[bs4]
0.53s call pandas/tests/io/test_sql.py::test_transactions[mysql_pymysql_conn]
0.53s setup pandas/tests/io/test_sql.py::test_api_multiindex_roundtrip[sqlite_str]
0.52s call pandas/tests/io/parser/test_parse_dates.py::test_bad_date_parse_with_warning[python-0-True]
0.52s call pandas/tests/io/test_sql.py::test_read_iris_query_chunksize[postgresql_psycopg2_conn_iris]
0.51s call pandas/tests/io/test_compression.py::test_with_missing_lzma_runtime
0.47s call pandas/tests/io/test_compression.py::test_with_missing_lzma
0.47s call pandas/tests/io/pytables/test_categorical.py::test_categorical
0.46s call pandas/tests/io/pytables/test_select.py::test_select_iterator_non_complete_8014
0.45s call pandas/tests/io/test_html.py::TestReadHtml::test_banklist_no_match[bs4]
0.44s call pandas/tests/io/excel/test_readers.py::TestReaders::test_read_excel_multiindex[(None, '.xlsx')]
0.40s call pandas/tests/io/excel/test_writers.py::TestExcelWriter::test_roundtrip_indexlabels[True-openpyxl-.xlsx]
0.39s call pandas/tests/io/parser/common/test_float.py::test_scientific_no_exponent[c_low-None]
0.38s call pandas/tests/io/formats/test_to_latex.py::TestToLatexHeader::test_to_latex_decimal
0.37s call pandas/tests/io/excel/test_readers.py::TestReaders::test_read_excel_nrows_params[('odf', '.ods')-testmultiindex-mi_column-header0-0-None]
0.37s call pandas/tests/io/excel/test_writers.py::TestRoundTrip::test_excel_multindex_roundtrip[3-3-None-None-.ods]
0.36s call pandas/tests/io/excel/test_readers.py::TestReaders::test_usecols_str[('odf', '.ods')]
0.35s call pandas/tests/io/parser/common/test_chunksize.py::test_warn_if_chunks_have_mismatched_type[c_low]
0.35s call pandas/tests/io/excel/test_writers.py::TestExcelWriter::test_duplicated_columns[odf-.ods]
0.34s call pandas/tests/io/excel/test_writers.py::TestExcelWriter::test_raise_when_saving_timezones[zoneinfo.ZoneInfo(key='UTC')-None-openpyxl-.xlsx]
0.34s call pandas/tests/io/excel/test_writers.py::TestExcelWriter::test_excel_010_hemstring[True-1-1-False-openpyxl-.xlsm]
0.34s teardown pandas/tests/io/formats/style/test_matplotlib.py::test_background_gradient_gmap_series_align[gmap2-0-exp_gmap2]
0.33s call pandas/tests/io/excel/test_readers.py::TestReaders::test_read_excel_multiindex_blank_after_name[('odf', '.ods')-both_name_multiple_blanks-idx_lvl21]
=========================== short test summary info ============================
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-dialect-None]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-dialect-doublequote]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-dialect-escapechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-dialect-skipinitialspace]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-dialect-quotechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-dialect-quoting]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-default-None]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-default-doublequote]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-default-escapechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-default-skipinitialspace]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-default-quotechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-default-quoting]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-other-None]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-other-doublequote]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-other-escapechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-other-skipinitialspace]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-other-quotechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_high-other-quoting]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-dialect-None]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-dialect-doublequote]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-dialect-escapechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-dialect-skipinitialspace]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-dialect-quotechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-dialect-quoting]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-default-None]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-default-doublequote]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-default-escapechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-default-skipinitialspace]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-default-quotechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-default-quoting]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-other-None]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-other-doublequote]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-other-escapechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-other-skipinitialspace]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-other-quotechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[c_low-other-quoting]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-dialect-None]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-dialect-doublequote]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-dialect-escapechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-dialect-skipinitialspace]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-dialect-quotechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-dialect-quoting]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-default-None]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-default-doublequote]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-default-escapechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-default-skipinitialspace]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-default-quotechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-default-quoting]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-other-None]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-other-doublequote]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-other-escapechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-other-skipinitialspace]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-other-quotechar]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_except_delimiter[python-other-quoting]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_high-sep-override-true]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_high-sep-override-false]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_high-delimiter-no-conflict]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_high-delimiter-default-arg]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_high-delimiter-conflict]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_high-delimiter-conflict2]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_low-sep-override-true]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_low-sep-override-false]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_low-delimiter-no-conflict]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_low-delimiter-default-arg]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_low-delimiter-conflict]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[c_low-delimiter-conflict2]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[python-sep-override-true]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[python-sep-override-false]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[python-delimiter-no-conflict]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[python-delimiter-default-arg]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[python-delimiter-conflict]
FAILED pandas/tests/io/parser/test_dialect.py::test_dialect_conflict_delimiter[python-delimiter-conflict2]
FAILED pandas/tests/io/test_common.py::TestMMapWrapper::test_warning_missing_utf_bom[bz2-utf-16]
FAILED pandas/tests/io/test_common.py::TestMMapWrapper::test_warning_missing_utf_bom[bz2-utf-32]
FAILED pandas/tests/io/test_common.py::TestMMapWrapper::test_warning_missing_utf_bom[xz-utf-16]
FAILED pandas/tests/io/test_common.py::TestMMapWrapper::test_warning_missing_utf_bom[xz-utf-32]
FAILED pandas/tests/io/xml/test_xml.py::test_utf16_encoding[lxml] - Assertion...
FAILED pandas/tests/io/xml/test_xml.py::test_utf16_encoding[etree] - Assertio...
= 78 failed, 11569 passed, 3427 skipped, 300 deselected, 139 xfailed in 119.09s (0:01:59) =
If required, the full build log is available here (for the next 30 days):
https://debusine.debian.net/artifact/771271/
This bug has been filed at "normal" severity, as we haven't started the
transition to add 3.13 as a supported version, yet. This will be raised to RC
as soon as that happens, hopefully well before trixie.
Thanks,
Stefano
More information about the debian-science-maintainers
mailing list