Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions tests/hamcrest_unit_test/core/future_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,20 @@ async def test():
await resolved(raise_exception()),
)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())

def testDoesNotMatchIfActualIsNotAFuture(self):
async def test():
self.assert_does_not_match("Not a future", future_raising(TypeError), 23)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())

def testDoesNotMatchIfFutureIsNotDone(self):
future = asyncio.Future()
future = asyncio.Future(loop=asyncio.new_event_loop())
self.assert_does_not_match("Unresolved future", future_raising(TypeError), future)

def testDoesNotMatchIfFutureIsCancelled(self):
future = asyncio.Future()
future = asyncio.Future(loop=asyncio.new_event_loop())
future.cancel()
self.assert_does_not_match("Cancelled future", future_raising(TypeError), future)

Expand All @@ -69,7 +69,7 @@ async def test():
expected_message, future_raising(TypeError), await resolved(raise_exception())
)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())

def testMatchesIfFutureHasASubclassOfTheExpectedException(self):
async def test():
Expand All @@ -79,15 +79,15 @@ async def test():
await resolved(raise_exception()),
)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())

def testDoesNotMatchIfFutureDoesNotHaveException(self):
async def test():
self.assert_does_not_match(
"No exception", future_raising(ValueError), await resolved(no_exception())
)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())

def testDoesNotMatchExceptionIfRegularExpressionDoesNotMatch(self):
async def test():
Expand All @@ -102,7 +102,7 @@ async def test():
await resolved(raise_exception()),
)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())

def testMatchesRegularExpressionToStringifiedException(self):
async def test():
Expand All @@ -118,7 +118,7 @@ async def test():
await resolved(raise_exception(3, 1, 4)),
)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())

def testMachesIfExceptionMatchesAdditionalMatchers(self):
async def test():
Expand All @@ -128,7 +128,7 @@ async def test():
await resolved(raise_exception_with_properties(prip="prop")),
)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())

def testDoesNotMatchIfAdditionalMatchersDoesNotMatch(self):
async def test():
Expand All @@ -143,7 +143,7 @@ async def test():
await resolved(raise_exception_with_properties(prip="prop")),
)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())

def testDoesNotMatchIfNeitherPatternOrMatcherMatch(self):
async def test():
Expand All @@ -162,4 +162,4 @@ async def test():
await resolved(raise_exception_with_properties(prip="prop")),
)

asyncio.get_event_loop().run_until_complete(test())
asyncio.new_event_loop().run_until_complete(test())