tests: Allow match for 8 bit color code in color.rules.t

The test proper coloring for overdue task from an hour ago fails,
even though the task is properly colored. This is because the blue color
gets upgraded to blue color in 256-color scheme, and hence is
represented with 38;5;4m instead of 34m.

Support both representations of the blue color in the given test.
This commit is contained in:
Tomas Babej
2020-12-14 23:13:40 -05:00
parent 982308412d
commit 7dfff13b06

View File

@@ -126,7 +126,8 @@ class TestColorRules(TestCase):
def test_due_anhourago(self):
"""Overdue color rule from an hour ago."""
code, out, err = self.t('/anhourago/ info')
self.assertIn('\x1b[34m', out)
# Match 4-bit or 8-bit blue color code
self.assertRegex(out, '\x1b\[(38;5;4|34)m')
def test_due_tomorrow(self):
"""Due tomorrow color rule."""