Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-148352: Add more colour to calendar CLI output#148354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
9e95c431fe0d933343a360843e5b4b202f0cab1a52f25c42c7e45a806719b32ca4ab58File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1068,6 +1068,7 @@ def test_several_leapyears_in_range(self): | ||
| def conv(s): | ||
| return s.replace('\n', os.linesep).encode() | ||
| @support.force_not_colorized_test_class | ||
| class CommandLineTestCase(unittest.TestCase): | ||
| def setUp(self): | ||
| self.runners = [self.run_cli_ok, self.run_cmd_ok] | ||
| @@ -1121,7 +1122,6 @@ def assertFailure(self, *args): | ||
| self.assertCLIFails(*args) | ||
| self.assertCmdFails(*args) | ||
| @support.force_not_colorized | ||
| def test_help(self): | ||
| stdout = self.run_cmd_ok('-h') | ||
| self.assertIn(b'usage:', stdout) | ||
| @@ -1256,6 +1256,15 @@ def test_html_output_year_css(self): | ||
| self.assertIn(b'<link rel="stylesheet" href="custom.css">', output) | ||
| @support.force_colorized_test_class | ||
| class ColorTestCase(unittest.TestCase): | ||
| def test_formatmonth_color(self): | ||
| today = datetime.date(2026, 5, 4) | ||
| cal = calendar._CLIDemoCalendar(highlight_day=today) | ||
| output = cal.formatmonth(2026, 5) | ||
| self.assertIn("\x1b[30m\x1b[43mMay 2026\x1b[0m\n\x1b[36m", output) | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, do we support running tests with different themes? If a user has a custom theme this test will fail. MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't support running tests with different themes. Other tests could also break if the user changed the theme: ❯ rg "x1b" Lib/test/test_*.py -l | wc -l 13Right now the theme API is internal/private. If we make it public in a later release, we'll need to consider tests are with the default theme or a specific theme. | ||
| class MiscTestCase(unittest.TestCase): | ||
| def test__all__(self): | ||
| not_exported = { | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Add more color to :mod:`calendar`'s CLI output. Patch by Hugo van Kemenade. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.