forked from retoor/devplacepy
Update
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
from devplacepy.services.devii.text import normalize_newlines
|
||||
|
||||
|
||||
def test_normalize_literal_backslash_n():
|
||||
raw = "[compacted earlier turns]\n\nHello\\n\\n## Title\\n\\n| A | B |"
|
||||
out = normalize_newlines(raw)
|
||||
assert "\\n" not in out or out.count("\n") > raw.count("\n")
|
||||
assert "\n\n## Title\n\n" in out
|
||||
assert out.startswith("[compacted earlier turns]\n\nHello\n")
|
||||
|
||||
|
||||
def test_normalize_leaves_real_newlines():
|
||||
raw = "line one\nline two\nline three"
|
||||
assert normalize_newlines(raw) == raw
|
||||
|
||||
|
||||
def test_normalize_double_escaped():
|
||||
raw = "a\\\\n\\\\nb"
|
||||
out = normalize_newlines(raw)
|
||||
assert "\n" in out
|
||||
assert out == "a\n\nb"
|
||||
Reference in New Issue
Block a user