Commit a30443ea authored by Stefan Behnel's avatar Stefan Behnel

Avoid C division by 0 to provoque a runtime error in a test, because MSVC...

Avoid C division by 0 to provoque a runtime error in a test, because MSVC considers it a compile time error.
parent 978edd3e
...@@ -1315,9 +1315,10 @@ class UnicodeTest(CommonTest, ...@@ -1315,9 +1315,10 @@ class UnicodeTest(CommonTest,
self.assertRaises(ValueError, '{}'.format_map, 'a') self.assertRaises(ValueError, '{}'.format_map, 'a')
self.assertRaises(ValueError, '{a} {}'.format_map, {"a" : 2, "b" : 1}) self.assertRaises(ValueError, '{a} {}'.format_map, {"a" : 2, "b" : 1})
ZERO = 0
class BadMapping: class BadMapping:
def __getitem__(self, key): def __getitem__(self, key):
return 1/0 return 1 / ZERO
self.assertRaises(KeyError, '{a}'.format_map, {}) self.assertRaises(KeyError, '{a}'.format_map, {})
self.assertRaises(TypeError, '{a}'.format_map, []) self.assertRaises(TypeError, '{a}'.format_map, [])
self.assertRaises(ZeroDivisionError, '{a}'.format_map, BadMapping()) self.assertRaises(ZeroDivisionError, '{a}'.format_map, BadMapping())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment