-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lukáš Doktor <[email protected]>
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
# | ||
# See LICENSE for more details. | ||
# | ||
# Copyright: Red Hat Inc. 2024 | ||
# Author: Lukas Doktor <[email protected]> | ||
|
||
# selftests pylint: disable=C0111,C0111 | ||
|
||
import unittest | ||
|
||
from aexpect.utils import astring | ||
|
||
|
||
class Astring(unittest.TestCase): | ||
|
||
def test_strip_console_codes(self): | ||
""" | ||
Try various strip_console_codes | ||
""" | ||
strip = astring.strip_console_codes | ||
self.assertEqual("simple color test", | ||
strip("simple\x1b[33;1m color \x1b[0mtest")) | ||
self.assertEqual("[33;1mstarts with code", "[33;1mstarts with code") | ||
self.assertEqual("ends with escape\x1b", "ends with escape\x1b") | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |