Initial commit: MUD client v0.2
This commit is contained in:
commit
0030fd7d82
26 files changed
+4421
No files matched your search
@@ -0,0 +1,25 @@
|
||||
"""Tests for the ANSI stripper."""
|
||||
from __future__ import annotations
|
||||
|
||||
from progetto2.ansi import strip_ansi, visible_len
|
||||
|
||||
|
||||
def test_strip_sgr() -> None:
|
||||
assert strip_ansi("\x1b[31mhello\x1b[0m") == "hello"
|
||||
|
||||
|
||||
def test_strip_cursor_moves() -> None:
|
||||
assert strip_ansi("a\x1b[2Jb\x1b[H") == "ab"
|
||||
|
||||
|
||||
def test_strip_osc() -> None:
|
||||
assert strip_ansi("\x1b]0;title\x07rest") == "rest"
|
||||
|
||||
|
||||
def test_strip_keep_tilde() -> None:
|
||||
# Tilde-style colour codes (CoCo/MUSH) should NOT be stripped by this module.
|
||||
assert "~rhello~n" in strip_ansi("~rhello~n") or strip_ansi("~rhello~n") == "~rhello~n"
|
||||
|
||||
|
||||
def test_visible_len() -> None:
|
||||
assert visible_len("\x1b[31mfoo\x1b[0m") == 3
|
||||
Reference in new issue
Block a user