We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents aa236dd + 94347d6 commit 807688eCopy full SHA for 807688e
src_c/rect.c
@@ -138,6 +138,7 @@ four_floats_from_obj(PyObject *obj, float *val1, float *val2, float *val3,
138
#define RectExport_getsize pg_rect_getsize
139
#define RectExport_setsize pg_rect_setsize
140
#define RectImport_primitiveType int
141
+#define RectImport_PrimitiveTypeName "int"
142
#define RectImport_RectCheck pgRect_Check
143
#define RectImport_OtherRectCheck pgFRect_Check
144
#define RectImport_OtherRectCheckExact pgFRect_CheckExact
@@ -257,6 +258,7 @@ four_floats_from_obj(PyObject *obj, float *val1, float *val2, float *val3,
257
258
#define RectExport_getsize pg_frect_getsize
259
#define RectExport_setsize pg_frect_setsize
260
#define RectImport_primitiveType float
261
+#define RectImport_PrimitiveTypeName "float"
262
#define RectImport_RectCheck pgFRect_Check
263
#define RectImport_OtherRectCheck pgRect_Check
264
#define RectImport_OtherRectCheckExact pgRect_CheckExact
src_c/rect_impl.h
@@ -324,14 +324,17 @@
324
#error RectImport_OtherRectCheck needs to be defined
325
#endif
326
#ifndef RectImport_RectCheckExact
327
-#error RectImport_RectCheckExact needs to be Defined
+#error RectImport_RectCheckExact needs to be defined
328
329
#ifndef RectImport_OtherRectCheckExact
330
#error RectImport_OtherRectCheckExact needs to be Defined
331
332
#ifndef RectImport_primitiveType
333
#error RectImport_primitiveType needs to be defined
334
335
+#ifndef RectImport_PrimitiveTypeName
336
+#error RectImport_PrimitiveTypeName needs to be defined
337
+#endif
338
#ifndef RectImport_innerRectStruct
339
#error RectImport_innerRectStruct needs to be defined
340
@@ -2010,7 +2013,8 @@ RectExport_containsSeq(RectObject *self, PyObject *arg)
2010
2013
if (ret < 0) {
2011
2014
PyErr_SetString(PyExc_TypeError, "'in <" ObjectName
2012
2015
">' requires rect style object"
- " or int as left operand");
2016
+ " or " RectImport_PrimitiveTypeName
2017
+ " as left operand");
2018
}
2019
return ret;
2020
@@ -3027,6 +3031,7 @@ RectExport_iterator(RectObject *self)
3027
3031
#undef RectImport_PythonNumberAsPrimitiveType
3028
3032
#undef RectImport_PrimitiveTypeAsPythonNumber
3029
3033
#undef RectImport_primitiveType
3034
+#undef RectImport_PrimitiveTypeName
3030
3035
#undef RectImport_RectCheck
3036
#undef RectImport_OtherRectCheck
3037
#undef RectImport_RectCheckExact
test/rect_test.py
@@ -808,6 +808,7 @@ def test_contains(self):
808
self.assertTrue(2 in Rect(0, 0, 1, 2), "r does not contain 2")
809
self.assertFalse(3 in Rect(0, 0, 1, 2), "r contains 3")
810
811
+ self.assertRaises(TypeError, lambda: 1.0 in Rect(0, 0, 1, 2))
812
self.assertRaises(TypeError, lambda: "string" in Rect(0, 0, 1, 2))
813
self.assertRaises(TypeError, lambda: 4 + 3j in Rect(0, 0, 1, 2))
814
@@ -3104,6 +3105,7 @@ def test_contains(self):
3104
3105
# self.assertTrue(2 in FRect(0, 0, 1, 2), "r does not contain 2")
3106
# self.assertFalse(3 in FRect(0, 0, 1, 2), "r contains 3")
3107
3108
+ self.assertRaises(TypeError, lambda: 1 in FRect(0, 0, 1, 2))
3109
self.assertRaises(TypeError, lambda: "string" in FRect(0, 0, 1, 2))
3110
self.assertRaises(TypeError, lambda: 4 + 3j in FRect(0, 0, 1, 2))
3111
0 commit comments