Try to fix tests failing on Python 3.11

This commit is contained in:
Kovid Goyal 2022-12-16 10:05:05 +05:30
parent 7d28d7413f
commit c6360537e5
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 6 additions and 3 deletions

View File

@ -265,7 +265,10 @@ as_color(ColorProfile *self, PyObject *val) {
Py_RETURN_NONE;
}
Color *ans = PyObject_New(Color, &Color_Type);
if (ans) ans->color.rgb = col;
if (ans) {
ans->color.val = 0;
ans->color.rgb = col;
}
return (PyObject*)ans;
}

View File

@ -36,7 +36,7 @@ EdgeLiteral = Literal['left', 'top', 'right', 'bottom']
UnderlineLiteral = Literal['straight', 'double', 'curly', 'dotted', 'dashed']
MatchType = Literal['mime', 'ext', 'protocol', 'file', 'path', 'url', 'fragment_matches']
PowerlineStyle = Literal['angled', 'slanted', 'round']
GRT_a = Literal['t', 'T', 'q', 'p', 'd', 'f', 'a', 'c', 'q']
GRT_a = Literal['t', 'T', 'q', 'p', 'd', 'f', 'a', 'c']
GRT_f = Literal[24, 32, 100]
GRT_t = Literal['d', 'f', 't', 's']
GRT_o = Literal['z']

View File

@ -443,7 +443,7 @@ class TestDataTypes(BaseTest):
c.update_ansi_color_table(build_ansi_color_table())
for i in range(8):
col = getattr(defaults, f'color{i}')
self.assertEqual(c.as_color(i << 8 | 1), col)
self.ae(c.as_color(i << 8 | 1), col)
self.ae(c.as_color(255 << 8 | 1), Color(0xee, 0xee, 0xee))
def test_historybuf(self):