MCPcopy
hub / github.com/pandas-dev/pandas / test_encode

Method test_encode

pandas/tests/io/test_html.py:1412–1438  ·  view source on GitHub ↗
(self, html_encoding_file, flavor_read_html)

Source from the content-addressed store, hash-verified

1410 "from_encoding.*:UserWarning"
1411 )
1412 def test_encode(self, html_encoding_file, flavor_read_html):
1413 base_path = os.path.basename(html_encoding_file)
1414 root = os.path.splitext(base_path)[0]
1415 _, encoding = root.split("_")
1416
1417 try:
1418 with open(html_encoding_file, "rb") as fobj:
1419 from_string = flavor_read_html(
1420 BytesIO(fobj.read()), encoding=encoding, index_col=0
1421 ).pop()
1422
1423 with open(html_encoding_file, "rb") as fobj:
1424 from_file_like = flavor_read_html(
1425 BytesIO(fobj.read()), encoding=encoding, index_col=0
1426 ).pop()
1427
1428 from_filename = flavor_read_html(
1429 html_encoding_file, encoding=encoding, index_col=0
1430 ).pop()
1431 tm.assert_frame_equal(from_string, from_file_like)
1432 tm.assert_frame_equal(from_string, from_filename)
1433 except Exception:
1434 # seems utf-16/32 fail on windows
1435 if is_platform_windows():
1436 if "16" in encoding or "32" in encoding:
1437 pytest.skip()
1438 raise
1439
1440 def test_parse_failure_unseekable(self, flavor_read_html):
1441 # Issue #17975

Callers

nothing calls this directly

Calls 5

is_platform_windowsFunction · 0.90
flavor_read_htmlFunction · 0.85
splitMethod · 0.80
popMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected