diff --git a/Lib/test/test_curses.py b/Lib/test/test_curses.py index cc3aa561cd4c42..4b43ab0d26faa4 100644 --- a/Lib/test/test_curses.py +++ b/Lib/test/test_curses.py @@ -751,7 +751,6 @@ def test_output_options(self): curses.nl(False) curses.nl() - def test_input_options(self): stdscr = self.stdscr @@ -943,9 +942,6 @@ def get_pair_limit(self): @requires_colors def test_pair_content(self): - if not hasattr(curses, 'use_default_colors'): - self.assertEqual(curses.pair_content(0), - (curses.COLOR_WHITE, curses.COLOR_BLACK)) curses.pair_content(0) maxpair = self.get_pair_limit() - 1 if maxpair > 0: @@ -990,13 +986,15 @@ def test_color_attrs(self): @requires_curses_func('use_default_colors') @requires_colors def test_use_default_colors(self): - old = curses.pair_content(0) + # The current terminal fg/bg colors given by pair_content(0), + # which is backed by extended_pair_content(3), depends on the + # terminal emulator and its supported colors. + curses.pair_content(0) try: curses.use_default_colors() except curses.error: self.skipTest('cannot change color (use_default_colors() failed)') self.assertEqual(curses.pair_content(0), (-1, -1)) - self.assertIn(old, [(curses.COLOR_WHITE, curses.COLOR_BLACK), (-1, -1), (0, 0)]) def test_keyname(self): # TODO: key_name() diff --git a/Misc/NEWS.d/next/Tests/2025-04-26-11-34-07.gh-issue-91221.qlhMVS.rst b/Misc/NEWS.d/next/Tests/2025-04-26-11-34-07.gh-issue-91221.qlhMVS.rst new file mode 100644 index 00000000000000..4f5d5be9c78419 --- /dev/null +++ b/Misc/NEWS.d/next/Tests/2025-04-26-11-34-07.gh-issue-91221.qlhMVS.rst @@ -0,0 +1,3 @@ +Do not check the output of :func:`curses.pair_content(0) +` since it depends on the terminal capabilities that +are not statically known. Patch by Bénédikt Tran.