Skip to content

Commit

Permalink
test_Exceptions: add tests for CardRequestTimeoutException
Browse files Browse the repository at this point in the history
  • Loading branch information
LudovicRousseau committed Mar 18, 2024
1 parent 7711146 commit 9438e62
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test_Exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,17 @@ def test_wrongType(self):
with self.assertRaises(TypeError):
hresult, hcontext = SCardEstablishContext("foo")

def test_CardRequestTimeoutException(self):
exc = CardRequestTimeoutException()
self.assertEqual(str(exc), "Time-out during card request")
exc = CardRequestTimeoutException(SCARD_E_NOT_TRANSACTED)
if platform.system() == 'Windows':
expected = "Time-out during card request: An attempt was made to end a non-existent transaction. (0x80100016)"
else:
expected = "Time-out during card request: Transaction failed. (0x80100016)"
self.assertEqual(str(exc), expected)
exc = CardRequestTimeoutException(hresult=SCARD_E_NOT_TRANSACTED)
self.assertEqual(str(exc), expected)

if __name__ == '__main__':
unittest.main()

0 comments on commit 9438e62

Please sign in to comment.