(self)
| 859 | self.assertTrue(sys._is_interned(s)) |
| 860 | |
| 861 | def test_sys_flags_indexable_attributes(self): |
| 862 | self.assertTrue(sys.flags) |
| 863 | # We've stopped assigning sequence indices to new sys.flags attributes: |
| 864 | # https://github.com/python/cpython/issues/122575#issuecomment-2416497086 |
| 865 | indexable_attrs = ("debug", |
| 866 | "inspect", "interactive", "optimize", |
| 867 | "dont_write_bytecode", "no_user_site", "no_site", |
| 868 | "ignore_environment", "verbose", "bytes_warning", "quiet", |
| 869 | "hash_randomization", "isolated", "dev_mode", "utf8_mode", |
| 870 | "warn_default_encoding", "safe_path", "int_max_str_digits") |
| 871 | for attr_idx, attr in enumerate(indexable_attrs): |
| 872 | self.assertHasAttr(sys.flags, attr) |
| 873 | attr_type = bool if attr in ("dev_mode", "safe_path") else int |
| 874 | self.assertEqual(type(getattr(sys.flags, attr)), attr_type, attr) |
| 875 | attr_value = getattr(sys.flags, attr) |
| 876 | self.assertEqual(sys.flags[attr_idx], attr_value, |
| 877 | msg=f"sys.flags .{attr} vs [{attr_idx}]") |
| 878 | self.assertTrue(repr(sys.flags)) |
| 879 | self.assertEqual(len(sys.flags), 18, msg="Do not increase, see GH-122575") |
| 880 | |
| 881 | self.assertIn(sys.flags.utf8_mode, {0, 1, 2}) |
| 882 | |
| 883 | def test_sys_flags_name_only_attributes(self): |
| 884 | # non-tuple sequence fields (name only sys.flags attributes) |
nothing calls this directly
no test coverage detected