You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Tests/test_strformat.py
+32-7Lines changed: 32 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -226,13 +226,27 @@ class bad2(object):
226
226
def__format__(self, *args):
227
227
return42
228
228
229
-
self.assertRaisesMessage(TypeError, "bad.__format__ must return a str, not NoneType"ifis_clielse"__format__ must return a str, not NoneType", '{0}'.format, bad())
230
-
self.assertRaisesMessage(TypeError, "bad2.__format__ must return a str, not int"ifis_clielse"__format__ must return a str, not int", '{0}'.format, bad2())
229
+
ifis_cli:
230
+
self.assertRaisesMessage(TypeError, "bad.__format__ must return a str, not NoneType", '{0}'.format, bad())
231
+
self.assertRaisesMessage(TypeError, "bad2.__format__ must return a str, not int", '{0}'.format, bad2())
232
+
elifsys.version_info>= (3, 5):
233
+
self.assertRaisesMessage(TypeError, "__format__ must return a str, not NoneType", '{0}'.format, bad())
234
+
self.assertRaisesMessage(TypeError, "__format__ must return a str, not int", '{0}'.format, bad2())
235
+
else:
236
+
self.assertRaisesMessage(TypeError, "__format__ method did not return string", '{0}'.format, bad())
237
+
self.assertRaisesMessage(TypeError, "__format__ method did not return string", '{0}'.format, bad2())
self.assertRaisesMessage(TypeError, "bad.__format__ must return a str, not NoneType"ifis_clielse"__format__ must return a str, not NoneType", format, bad())
235
-
self.assertRaisesMessage(TypeError, "bad2.__format__ must return a str, not int"ifis_clielse"__format__ must return a str, not int", format, bad2())
241
+
ifis_cli:
242
+
self.assertRaisesMessage(TypeError, "bad.__format__ must return a str, not NoneType", format, bad())
243
+
self.assertRaisesMessage(TypeError, "bad2.__format__ must return a str, not int", format, bad2())
244
+
elifsys.version_info>= (3, 5):
245
+
self.assertRaisesMessage(TypeError, "__format__ must return a str, not NoneType", format, bad())
246
+
self.assertRaisesMessage(TypeError, "__format__ must return a str, not int", format, bad2())
247
+
else:
248
+
self.assertRaisesMessage(TypeError, "__format__ method did not return string", format, bad())
249
+
self.assertRaisesMessage(TypeError, "__format__ method did not return string", format, bad2())
0 commit comments