diff options
author | Ask Solem <ask@celeryproject.org> | 2017-02-10 12:52:33 -0800 |
---|---|---|
committer | Ask Solem <ask@celeryproject.org> | 2017-02-10 12:52:33 -0800 |
commit | 932bb6caff01d15ec9d02a376e90647ec39293e9 (patch) | |
tree | fb85bf3c12c4d087f57c03d36d5346c6e31fff94 /t/unit/test_utils.py | |
parent | aed8e8431bb61f0937447b5c8ef497ff931d8693 (diff) | |
download | py-amqp-3.0-devel.tar.gz |
Use keyword-only arguments3.0-devel
Diffstat (limited to 't/unit/test_utils.py')
-rw-r--r-- | t/unit/test_utils.py | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/t/unit/test_utils.py b/t/unit/test_utils.py deleted file mode 100644 index 418e4df..0000000 --- a/t/unit/test_utils.py +++ /dev/null @@ -1,57 +0,0 @@ -from case import Mock, patch -from amqp.utils import get_errno, want_bytes, want_str, get_logger - - -class test_get_errno: - - def test_has_attr(self): - exc = KeyError('foo') - exc.errno = 23 - assert get_errno(exc) == 23 - - def test_in_args(self): - exc = KeyError(34, 'foo') - exc.args = (34, 'foo') - assert get_errno(exc) == 34 - - def test_args_short(self): - exc = KeyError(34) - assert not get_errno(exc) - - def test_no_args(self): - assert not get_errno(object()) - - -class test_want_bytes: - - def test_from_unicode(self): - assert isinstance(want_bytes('foo'), bytes) - - def test_from_bytes(self): - assert isinstance(want_bytes(b'foo'), bytes) - - -class test_want_str: - - def test_from_unicode(self): - assert isinstance(want_str('foo'), str) - - def test_from_bytes(self): - assert want_str(b'foo') - - -class test_get_logger: - - @patch('logging.getLogger') - def test_as_str(self, getLogger): - x = get_logger('foo.bar') - getLogger.assert_called_with('foo.bar') - assert x is getLogger() - - @patch('logging.NullHandler') - def test_as_logger(self, _NullHandler): - m = Mock(name='logger') - m.handlers = None - x = get_logger(m) - assert x is m - x.addHandler.assert_called_with(_NullHandler()) |