Skip to content

Commit

Permalink
Add tests for llcp/err.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nehpetsde committed Jul 21, 2017
1 parent 6a9cba8 commit 60b02c2
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/test_llcp_err.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division

import errno
import nfc.llcp.err


def test_llcp_error_class():
err = nfc.llcp.Error(errno.EPIPE)
assert isinstance(err, nfc.llcp.Error)
assert isinstance(err, IOError)
assert err.errno == errno.EPIPE
assert str(err) == "nfc.llcp.Error: [EPIPE] Broken pipe"


def test_connect_refused():
err = nfc.llcp.ConnectRefused(reason=1)
assert isinstance(err, nfc.llcp.ConnectRefused)
assert isinstance(err, nfc.llcp.Error)
assert err.errno == errno.ECONNREFUSED
assert err.reason == 1
assert str(err) == ("nfc.llcp.ConnectRefused: [ECONNREFUSED] "
"Connection refused with reason 1")

0 comments on commit 60b02c2

Please sign in to comment.