pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/ipython/ipython/commit/8aae9a39bd6b44d4a798540a8d4863f73593ff57

strip ansi for comparison · ipython/ipython@8aae9a3 · GitHub
Skip to content

Commit 8aae9a3

Browse files
committed
strip ansi for comparison
1 parent e1aadc2 commit 8aae9a3

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

tests/test_magic.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,8 +1094,21 @@ def test_notebook_export_json_with_output():
10941094
expected = expected_nb["cells"][i]
10951095
assert expected["source"] == command
10961096
assert actual["source"] == expected["source"]
1097-
assert (
1098-
actual["outputs"] == expected["outputs"]
1097+
_strip_ansi = re.compile(r"\x1b\[[0-9;]*m").sub
1098+
1099+
def strip_ansi_from_outputs(outputs):
1100+
result = []
1101+
for out in outputs:
1102+
out = dict(out)
1103+
if "traceback" in out:
1104+
out["traceback"] = [
1105+
_strip_ansi("", line) for line in out["traceback"]
1106+
]
1107+
result.append(out)
1108+
return result
1109+
1110+
assert strip_ansi_from_outputs(actual["outputs"]) == strip_ansi_from_outputs(
1111+
expected["outputs"]
10991112
), f"Outputs do not match for cell {i+1} with source {command!r}"
11001113
finally:
11011114
_ip.colors = "nocolor"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy