#NEWLINE# @ pytest . mark . parametrize ( 'disable' , [ True , False ] ) #NEWLINE# @ pytest . mark . parametrize ( 'in_,expected_colors,expected_no_colors' , [ ( '' , '' , '' ) , ( 'test' , 'test' , 'test' ) , ( '{b}TEST{/b}' , '\x1b[1mTEST\x1b[22m' , 'TEST' ) , ( '{red}{bgred}TEST{/all}' , '\x1b[31;41mTEST\x1b[0m' , 'TEST' ) , ( '{b}A {red}B {green}{bgred}C {/all}' , '\x1b[1mA \x1b[31mB \x1b[32;41mC \x1b[0m' , 'A B C ' ) , ( 'C {/all}{b}{blue}{hiblue}{bgcyan}D {/all}' , 'C \x1b[0;1;46;94mD \x1b[0m' , 'C D ' ) , ( 'D {/all}{i}\x1b[31;103mE {/all}' , 'D \x1b[0;3;31;103mE \x1b[0m' , 'D E ' ) , ( '{b}{red}{bgblue}{/all}{i}TEST{/all}' , '\x1b[0;3mTEST\x1b[0m' , 'TEST' ) , ( '{red}{green}{blue}{black}{yellow}TEST{/fg}{/all}' , '\x1b[33mTEST\x1b[0m' , 'TEST' ) , ( '{bgred}{bggreen}{bgblue}{bgblack}{bgyellow}TEST{/bg}{/all}' , '\x1b[43mTEST\x1b[0m' , 'TEST' ) , ( '{red}T{red}E{red}S{red}T{/all}' , '\x1b[31mTEST\x1b[0m' , 'TEST' ) , ( '{red}T{/all}E{/all}S{/all}T{/all}' , '\x1b[31mT\x1b[0mEST' , 'TEST' ) , ( '{red}{bgblue}TES{red}{bgblue}T{/all}' , '\x1b[31;44mTEST\x1b[0m' , 'TEST' ) ] ) #NEWLINE# def test_parse_input( disable , in_ , expected_colors , expected_no_colors ) : #NEWLINE# #INDENT# 'Test function.\n\n    :param bool disable: Disable colors?\n    :param str in_: Input string to pass to function.\n    :param str expected_colors: Expected first item of return value.\n    :param str expected_no_colors: Expected second item of return value.\n    ' #NEWLINE# ( actual_colors , actual_no_colors ) = parse_input ( in_ , disable ) #NEWLINE# if disable : #NEWLINE# #INDENT# assert ( expected_colors == expected_no_colors ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert ( actual_colors == expected_colors ) #NEWLINE# #UNINDENT# assert ( actual_no_colors == expected_no_colors )