@@ -7058,7 +7058,7 @@ def setUp(self):
70587058 super ().setUp ()
70597059 # Ensure color even if ran with NO_COLOR=1
70607060 _colorize .can_colorize = lambda * args , ** kwargs : True
7061- self .ansi = _colorize .ANSIColors ()
7061+ self .theme = _colorize .get_theme ( force_color = True ). argparse
70627062
70637063 def test_argparse_color (self ):
70647064 # Arrange: create a parser with a bit of everything
@@ -7120,13 +7120,17 @@ def test_argparse_color(self):
71207120 sub2 = subparsers .add_parser ("sub2" , deprecated = True , help = "sub2 help" )
71217121 sub2 .add_argument ("--baz" , choices = ("X" , "Y" , "Z" ), help = "baz help" )
71227122
7123- heading = self .ansi .BOLD_BLUE
7124- label , label_b = self .ansi .YELLOW , self .ansi .BOLD_YELLOW
7125- long , long_b = self .ansi .CYAN , self .ansi .BOLD_CYAN
7126- pos , pos_b = short , short_b = self .ansi .GREEN , self .ansi .BOLD_GREEN
7127- sub = self .ansi .BOLD_GREEN
7128- prog = self .ansi .BOLD_MAGENTA
7129- reset = self .ansi .RESET
7123+ prog = self .theme .prog
7124+ heading = self .theme .heading
7125+ long = self .theme .summary_long_option
7126+ short = self .theme .summary_short_option
7127+ label = self .theme .summary_label
7128+ pos = self .theme .summary_action
7129+ long_b = self .theme .long_option
7130+ short_b = self .theme .short_option
7131+ label_b = self .theme .label
7132+ pos_b = self .theme .action
7133+ reset = self .theme .reset
71307134
71317135 # Act
71327136 help_text = parser .format_help ()
@@ -7171,9 +7175,9 @@ def test_argparse_color(self):
71717175 { heading } subcommands:{ reset }
71727176 valid subcommands
71737177
7174- { sub } {{sub1,sub2}}{ reset } additional help
7175- { sub } sub1{ reset } sub1 help
7176- { sub } sub2{ reset } sub2 help
7178+ { pos_b } {{sub1,sub2}}{ reset } additional help
7179+ { pos_b } sub1{ reset } sub1 help
7180+ { pos_b } sub2{ reset } sub2 help
71777181 """
71787182 ),
71797183 )
@@ -7187,10 +7191,10 @@ def test_argparse_color_usage(self):
71877191 prog = "PROG" ,
71887192 usage = "[prefix] %(prog)s [suffix]" ,
71897193 )
7190- heading = self .ansi . BOLD_BLUE
7191- prog = self .ansi . BOLD_MAGENTA
7192- reset = self .ansi . RESET
7193- usage = self .ansi . MAGENTA
7194+ heading = self .theme . heading
7195+ prog = self .theme . prog
7196+ reset = self .theme . reset
7197+ usage = self .theme . prog_extra
71947198
71957199 # Act
71967200 help_text = parser .format_help ()
0 commit comments