コード例 #1
0
def test_nested():
    assert str(ansistyle.Text(0o075, "foo", ansistyle.Text(
        0o050, "bar"))) == "\033[45mfoo\033[35;40mbar\033[0m"
    assert str(ansistyle.Text(
        0o075, "foo", (0o050, "bar"))) == "\033[45mfoo\033[35;40mbar\033[0m"
    assert str(ansistyle.Text(
        0o075, "foo",
        (0o050, (0o060, "bar"),
         "baz"))) == "\033[45mfoo\033[36;40mbar\033[35mbaz\033[0m"
コード例 #2
0
def test_bug():
	assert str(ansistyle.Text(-1, "x", (0o150, "y"), "z")) == "x\033[1;35my\033[0mz"
コード例 #3
0
def test_all():
	assert str(ansistyle.Text(0o754, "foo")) == "\033[1;4;5;35;44mfoo\033[0m"
	assert str(ansistyle.Text(0o754, "foo", ansistyle.Text(0o070, "bar"))) == "\033[1;4;5;35;44mfoo\033[0mbar"
コード例 #4
0
def test_foreground():
	assert str(ansistyle.Text(0o050, "foo")) == "\033[35mfoo\033[0m"
	assert str(ansistyle.Text(0o050, "foo", ansistyle.Text(0o070, "bar"))) == "\033[35mfoo\033[0mbar"
コード例 #5
0
def test_background():
	assert str(ansistyle.Text(0o075, "foo")) == "\033[45mfoo\033[0m"
	assert str(ansistyle.Text(0o075, "foo", ansistyle.Text(0o070, "bar"))) == "\033[45mfoo\033[0mbar"
コード例 #6
0
def test_bold():
	assert str(ansistyle.Text(0o170, "foo")) == "\033[1mfoo\033[0m"
	assert str(ansistyle.Text(0o170, "foo", ansistyle.Text(0o070, "bar"))) == "\033[1mfoo\033[0mbar"
コード例 #7
0
def test_underline():
	assert str(ansistyle.Text(0o270, "foo")) == "\033[4mfoo\033[0m"
	assert str(ansistyle.Text(0o270, "foo", ansistyle.Text(0o070, "bar"))) == "\033[4mfoo\033[0mbar"
コード例 #8
0
def test_blink():
	assert str(ansistyle.Text(0o470, "foo")) == "\033[5mfoo\033[0m"
	assert str(ansistyle.Text(0o470, "foo", ansistyle.Text(0o070, "bar"))) == "\033[5mfoo\033[0mbar"