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"
def test_bug(): assert str(ansistyle.Text(-1, "x", (0o150, "y"), "z")) == "x\033[1;35my\033[0mz"
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"
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"
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"
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"
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"
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"