- Notifications
You must be signed in to change notification settings - Fork 417
/
Copy pathtest_test.py
46 lines (29 loc) · 1.26 KB
/
test_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Copyright (C) 2016-present the asyncpg authors and contributors
# <see AUTHORS file>
#
# This module is part of asyncpg and is released under
# the Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0
importasyncio
importtypes
importunittest
fromasyncpgimport_testbaseastb
classBaseSimpleTestCase:
asyncdeftest_tests_zero_error(self):
awaitasyncio.sleep(0.01)
1/0
classTestTests(unittest.TestCase):
deftest_tests_fail_1(self):
SimpleTestCase=types.new_class('SimpleTestCase',
(BaseSimpleTestCase, tb.TestCase))
suite=unittest.TestSuite()
suite.addTest(SimpleTestCase('test_tests_zero_error'))
result=unittest.TestResult()
suite.run(result)
self.assertIn('ZeroDivisionError', result.errors[0][1])
classTestHelpers(tb.TestCase):
asyncdeftest_tests_assertLoopErrorHandlerCalled_01(self):
withself.assertRaisesRegex(AssertionError, r'no message.*was logged'):
withself.assertLoopErrorHandlerCalled('aa'):
self.loop.call_exception_handler({'message': 'bb a bb'})
withself.assertLoopErrorHandlerCalled('aa'):
self.loop.call_exception_handler({'message': 'bbaabb'})