<s> """<STR_LIT>""" <EOL> import sys <EOL> from functools import partial <EOL> import pytest <EOL> from colorclass . color import Color <EOL> from tests . conftest import assert_both_values , get_instance <EOL> def test_colorize_methods ( ) : <EOL> """<STR_LIT>""" <EOL> assert Color . black ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . bgblack ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . red ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . bgred ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . green ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . bggreen ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . yellow ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . bgyellow ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . blue ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . bgblue ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . magenta ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . bgmagenta ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . cyan ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . bgcyan ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . white ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . bgwhite ( '<STR_LIT>' ) . value_colors == '<STR_LIT>' <EOL> assert Color . black ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . black ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgblack ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgblack ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . red ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . red ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgred ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgred ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . green ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . green ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bggreen ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bggreen ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . yellow ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . yellow ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgyellow ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgyellow ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . blue ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . blue ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgblue ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgblue ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . magenta ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . magenta ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgmagenta ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgmagenta ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . cyan ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . cyan ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgcyan ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgcyan ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . white ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . white ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgwhite ( '<STR_LIT>' , auto = True ) == Color ( '<STR_LIT>' ) <EOL> assert Color . bgwhite ( '<STR_LIT>' ) == Color ( '<STR_LIT>' ) <EOL> @ pytest . mark . parametrize ( '<STR_LIT>' , [ '<STR_LIT:str>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test_chaining ( kind ) : <EOL> """<STR_LIT>""" <EOL> assert_both = partial ( assert_both_values , kind = kind ) <EOL> instance = get_instance ( kind , '<STR_LIT>' ) <EOL> for color in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) : <EOL> instance = get_instance ( kind , instance , color ) <EOL> assert_both ( instance , '<STR_LIT>' , '<STR_LIT>' ) <EOL> instance = get_instance ( kind ) <EOL> for color in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) : <EOL> instance = get_instance ( kind , instance , color ) <EOL> assert_both ( instance , '<STR_LIT>' , '<STR_LIT>' ) <EOL> instance = '<STR_LIT>' <EOL> for color in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) : <EOL> instance = get_instance ( kind , instance , color = color ) <EOL> assert_both ( instance , '<STR_LIT>' , '<STR_LIT>' ) <EOL> instance = get_instance ( kind , '<STR_LIT>' ) . format ( get_instance ( kind , '<STR_LIT>' ) ) <EOL> assert_both ( instance , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert len ( instance ) == <NUM_LIT:4> <EOL> instance = get_instance ( kind , '<STR_LIT>' ) . format ( instance ) <EOL> assert_both ( instance , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert len ( instance ) == <NUM_LIT:4> <EOL> instance = get_instance ( kind , '<STR_LIT>' ) . format ( instance ) <EOL> assert_both ( instance , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert len ( instance ) == <NUM_LIT:4> <EOL> @ pytest . mark . parametrize ( '<STR_LIT>' , [ '<STR_LIT:str>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> def test_empty ( kind ) : <EOL> """<STR_LIT>""" <EOL> instance = get_instance ( kind , u'<STR_LIT>' ) <EOL> assert_both = partial ( assert_both_values , kind = kind ) <EOL> assert len ( instance ) == <NUM_LIT:0> <EOL> assert_both ( instance * <NUM_LIT:2> , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance + instance , '<STR_LIT>' , '<STR_LIT>' ) <EOL> with pytest . raises ( IndexError ) : <EOL> assert instance [ <NUM_LIT:0> ] <EOL> assert not [ i for i in instance ] <EOL> assert not list ( instance ) <EOL> assert instance . encode ( '<STR_LIT:utf-8>' ) == instance . encode ( '<STR_LIT:utf-8>' ) <EOL> assert instance . encode ( '<STR_LIT:utf-8>' ) . decode ( '<STR_LIT:utf-8>' ) == instance <EOL> assert_both ( instance . encode ( '<STR_LIT:utf-8>' ) . decode ( '<STR_LIT:utf-8>' ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance . __class__ . encode ( instance , '<STR_LIT:utf-8>' ) . decode ( '<STR_LIT:utf-8>' ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert len ( instance . encode ( '<STR_LIT:utf-8>' ) . decode ( '<STR_LIT:utf-8>' ) ) == <NUM_LIT:0> <EOL> assert_both ( instance . format ( value = '<STR_LIT>' ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance . capitalize ( ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance . center ( <NUM_LIT:5> ) , '<STR_LIT:U+0020>' , '<STR_LIT>' ) <EOL> assert instance . count ( '<STR_LIT>' ) == <NUM_LIT:1> <EOL> assert instance . count ( '<STR_LIT:t>' ) == <NUM_LIT:0> <EOL> assert instance . endswith ( '<STR_LIT>' ) is True <EOL> assert instance . endswith ( '<STR_LIT>' ) is False <EOL> assert instance . find ( '<STR_LIT>' ) == <NUM_LIT:0> <EOL> assert instance . find ( '<STR_LIT:t>' ) == - <NUM_LIT:1> <EOL> assert instance . index ( '<STR_LIT>' ) == <NUM_LIT:0> <EOL> with pytest . raises ( ValueError ) : <EOL> assert instance . index ( '<STR_LIT:t>' ) <EOL> assert instance . isalnum ( ) is False <EOL> assert instance . isalpha ( ) is False <EOL> if sys . version_info [ <NUM_LIT:0> ] != <NUM_LIT:2> : <EOL> assert instance . isdecimal ( ) is False <EOL> assert instance . isdigit ( ) is False <EOL> if sys . version_info [ <NUM_LIT:0> ] != <NUM_LIT:2> : <EOL> assert instance . isnumeric ( ) is False <EOL> assert instance . isspace ( ) is False <EOL> assert instance . istitle ( ) is False <EOL> assert instance . isupper ( ) is False <EOL> assert_both ( instance . join ( [ '<STR_LIT:A>' , '<STR_LIT:B>' ] ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance . ljust ( <NUM_LIT:5> ) , '<STR_LIT:U+0020>' , '<STR_LIT>' ) <EOL> assert instance . rfind ( '<STR_LIT>' ) == <NUM_LIT:0> <EOL> assert instance . rfind ( '<STR_LIT:t>' ) == - <NUM_LIT:1> <EOL> assert instance . rindex ( '<STR_LIT>' ) == <NUM_LIT:0> <EOL> with pytest . raises ( ValueError ) : <EOL> assert instance . rindex ( '<STR_LIT:t>' ) <EOL> assert_both ( instance . rjust ( <NUM_LIT:5> ) , '<STR_LIT:U+0020>' , '<STR_LIT>' ) <EOL> if kind in ( '<STR_LIT:str>' , '<STR_LIT>' ) : <EOL> assert instance . splitlines ( ) == list ( ) <EOL> else : <EOL> assert instance . splitlines ( ) == [ '<STR_LIT>' ] <EOL> assert instance . startswith ( '<STR_LIT>' ) is True <EOL> assert instance . startswith ( '<STR_LIT:T>' ) is False <EOL> assert_both ( instance . swapcase ( ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance . title ( ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance . translate ( { ord ( '<STR_LIT:t>' ) : u'<STR_LIT:1>' , ord ( '<STR_LIT:e>' ) : u'<STR_LIT:2>' , ord ( '<STR_LIT:s>' ) : u'<STR_LIT:3>' } ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance . upper ( ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance . zfill ( <NUM_LIT:0> ) , '<STR_LIT>' , '<STR_LIT>' ) <EOL> assert_both ( instance . zfill ( <NUM_LIT:1> ) , '<STR_LIT:0>' , '<STR_LIT:0>' ) </s>
