improving tests
This commit is contained in:
@@ -89,7 +89,7 @@ def test_minify():
|
||||
assert_equals("\033[1;32;41mHello\n", couleur.minify("\033[1;32;41mHello\n"))
|
||||
|
||||
def test_ignoring_colors():
|
||||
"file-like filter output: bold green on white"
|
||||
"file-like filter output: ignoring output"
|
||||
|
||||
io = StringIO()
|
||||
couleur.proxy(io).enable()
|
||||
|
@@ -77,6 +77,21 @@ def test_output_green_and_red_on_white_foreground():
|
||||
sys.stderr.write("#{black}should not be translated\n")
|
||||
assert_stderr('#{black}should not be translated\n')
|
||||
|
||||
@with_setup(prepare_stderr)
|
||||
def test_errput_stderr_ignoring_errput():
|
||||
"STDERR filter errput: ignoring output"
|
||||
|
||||
couleur.proxy(sys.stderr).enable()
|
||||
couleur.proxy(sys.stderr).ignore()
|
||||
sys.stderr.write("#{green}Hello #{white}#{on:blue}World!#{reset}\n")
|
||||
assert_stderr('Hello World!\n')
|
||||
couleur.proxy(sys.stderr).enable()
|
||||
sys.stderr.write("#{green}Hi There!\n")
|
||||
assert_stderr('\033[32mHi There!\n')
|
||||
couleur.proxy(sys.stderr).disable()
|
||||
sys.stderr.write("#{black}should not be translated\n")
|
||||
assert_stderr('#{black}should not be translated\n')
|
||||
|
||||
def test_integration_with_stderr():
|
||||
"STDERR filter integration"
|
||||
|
||||
|
@@ -77,6 +77,21 @@ def test_output_green_and_red_on_white_foreground():
|
||||
print "#{black}should not be translated"
|
||||
assert_stdout('#{black}should not be translated\n')
|
||||
|
||||
@with_setup(prepare_stdout)
|
||||
def test_output_stdout_ignoring_output():
|
||||
"STDOUT filter output: green foreground and white on red background"
|
||||
|
||||
couleur.proxy(sys.stdout).enable()
|
||||
couleur.proxy(sys.stdout).ignore()
|
||||
print "#{green}Hello #{white}#{on:blue}World!#{reset}"
|
||||
assert_stdout('Hello World!\n')
|
||||
couleur.proxy(sys.stdout).enable()
|
||||
print "#{green}Hi There!"
|
||||
assert_stdout('\033[32mHi There!\n')
|
||||
couleur.proxy(sys.stdout).disable()
|
||||
print "#{black}should not be translated"
|
||||
assert_stdout('#{black}should not be translated\n')
|
||||
|
||||
def test_integration_with_stdout():
|
||||
"STDOUT filter integration"
|
||||
|
||||
|
Reference in New Issue
Block a user