コード例 #1
0
ファイル: test_colorsh.py プロジェクト: radiand/colorsh
    def test_decorate_tmux_style(self):
        self.assertEqual(
            "#[fg=bold]example",
            Colorsh.decorate("example", enc="tmux", style=Style(["bold"])))

        self.assertEqual(
            "#[fg=bold,italics]example",
            Colorsh.decorate("example",
                             enc="tmux",
                             style=Style(["bold", "italics"])))
コード例 #2
0
ファイル: test_colorsh.py プロジェクト: radiand/colorsh
 def test_decorate_ansi_style_takes_only_first_style_from_list(self):
     self.assertEqual(
         ANSI_ESCAPE_SEQUENCE + "1m" + "example" + ANSI_ESCAPE_SEQUENCE +
         "0m",
         Colorsh.decorate("example",
                          enc="ansi",
                          style=Style(["bold", "faint", 3])))
コード例 #3
0
ファイル: test_style.py プロジェクト: radiand/colorsh
 def test_parse_from_not_uniform_list_with_another_list_inside(self):
     s = Style([1, ["faint", Styles.italics]])
     self.assertEqual(s.styles[0].name, "bold")
     self.assertEqual(s.styles[0].value, 1)
     self.assertEqual(s.styles[1].name, "faint")
     self.assertEqual(s.styles[1].value, 2)
     self.assertEqual(s.styles[2].name, "italics")
     self.assertEqual(s.styles[2].value, 3)
コード例 #4
0
ファイル: test_colorsh.py プロジェクト: radiand/colorsh
 def test_decorate_tmux_color_and_style(self):
     self.assertEqual(
         "#[fg=colour9,bold,italics,bg=colour12]example",
         Colorsh.decorate("example",
                          enc="tmux",
                          fg=Color("red"),
                          bg=Color("blue"),
                          style=Style(["bold", "italics"])))
コード例 #5
0
ファイル: test_colorsh.py プロジェクト: radiand/colorsh
 def test_decorate_ansi_color_and_style(self):
     self.assertEqual(
         ANSI_ESCAPE_SEQUENCE + "1;38;5;9;48;5;12m" + "example" +
         ANSI_ESCAPE_SEQUENCE + "0m",
         Colorsh.decorate("example",
                          enc="ansi",
                          fg=Color("red"),
                          bg=Color("blue"),
                          style=Style(["bold"])))
コード例 #6
0
ファイル: test_style.py プロジェクト: radiand/colorsh
 def test_parse_from_int_not_in_range(self):
     s = Style(1984)
     self.assertEqual(s.styles, [])
コード例 #7
0
ファイル: test_style.py プロジェクト: radiand/colorsh
 def test_parse_from_int_in_range(self):
     s = Style(1)
     self.assertEqual(s.styles[0].name, "bold")
     self.assertEqual(s.styles[0].value, 1)
コード例 #8
0
ファイル: test_style.py プロジェクト: radiand/colorsh
 def test_parse_from_uniform_list(self):
     s = Style(["bold", "faint"])
     self.assertEqual(s.styles[0].name, "bold")
     self.assertEqual(s.styles[0].value, 1)
     self.assertEqual(s.styles[1].name, "faint")
     self.assertEqual(s.styles[1].value, 2)
コード例 #9
0
ファイル: test_style.py プロジェクト: radiand/colorsh
 def test_parse_from_styles_enum(self):
     s = Style(Styles.bold)
     self.assertEqual(s.styles[0].name, "bold")
     self.assertEqual(s.styles[0].value, 1)
コード例 #10
0
ファイル: test_style.py プロジェクト: radiand/colorsh
 def test_parse_from_string_not_in_range(self):
     s = Style("damnNiceStyleButNotSupported")
     self.assertEqual(s.styles, [])
コード例 #11
0
ファイル: test_colorsh.py プロジェクト: radiand/colorsh
 def test_decorate_ansi_style(self):
     self.assertEqual(
         ANSI_ESCAPE_SEQUENCE + "1m" + "example" + ANSI_ESCAPE_SEQUENCE +
         "0m", Colorsh.decorate("example",
                                enc="ansi",
                                style=Style(["bold"])))