Files
zulip/zerver/lib/mdiff.py
Anders Kaseorg df001db1a9 black: Reformat with Black 23.
Black 23 enforces some slightly more specific rules about empty line
counts and redundant parenthesis removal, but the result is still
compatible with Black 22.

(This does not actually upgrade our Python environment to Black 23
yet.)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-02 10:40:13 -08:00

20 lines
498 B
Python

import logging
import os
import subprocess
class DiffError(Exception):
pass
def diff_strings(output: str, expected_output: str) -> str:
mdiff_path = "frontend_tests/zjsunit/mdiff.js"
if not os.path.isfile(mdiff_path): # nocoverage
msg = "Cannot find mdiff for Markdown diff rendering"
logging.error(msg)
raise DiffError(msg)
command = ["node", mdiff_path, output, expected_output]
diff = subprocess.check_output(command, text=True)
return diff