Пример #1
0
def test_get_fileno_of_wrong_type_fails():
    try:
        select.get_fileno('foo')
    except TypeError as ex:
        assert str(ex) == expected_get_fileno_type_error_message
    else:
        assert False, 'Expected TypeError not raised'
Пример #2
0
def test_get_fileno_of_wrong_type_fails():
    try:
        select.get_fileno('foo')
    except TypeError as ex:
        assert str(ex) == 'Expected int or long, got <type \'str\'>'
    else:
        assert False, 'Expected TypeError not raised'
Пример #3
0
def test_get_fileno_of_wrong_type_fails():
    try:
        select.get_fileno('foo')
    except TypeError as ex:
        assert str(ex) == expected_get_fileno_type_error_message
    else:
        assert False, 'Expected TypeError not raised'
Пример #4
0
def test_get_fileno_of_a_socket_with_fileno_returning_wrong_type_fails():
    class DummySocket(object):
        def fileno(self):
            return 'foo'
    try:
        select.get_fileno(DummySocket())
    except TypeError as ex:
        assert str(ex) == expected_get_fileno_type_error_message
    else:
        assert False, 'Expected TypeError not raised'
Пример #5
0
def test_get_fileno_of_a_socket_with_fileno_returning_wrong_type_fails():
    class DummySocket(object):
        def fileno(self):
            return 'foo'
    try:
        select.get_fileno(DummySocket())
    except TypeError as ex:
        assert str(ex) == 'Expected int or long, got <type \'str\'>'
    else:
        assert False, 'Expected TypeError not raised'
Пример #6
0
def test_get_fileno_of_a_socket_with_fileno_returning_wrong_type_fails():
    class DummySocket(object):
        def fileno(self):
            return 'foo'
    try:
        select.get_fileno(DummySocket())
    except TypeError as ex:
        assert str(ex) == expected_get_fileno_type_error_message
    else:
        assert False, 'Expected TypeError not raised'
Пример #7
0
def test_get_fileno_of_an_int_works():
    assert select.get_fileno(123) == 123
Пример #8
0
def test_get_fileno_of_a_socket_works():
    class DummySocket(object):
        def fileno(self):
            return 123

    assert select.get_fileno(DummySocket()) == 123
Пример #9
0
def test_get_fileno_of_an_int_works():
    assert select.get_fileno(123) == 123
Пример #10
0
def test_get_fileno_of_a_socket_works():
    class DummySocket(object):
        def fileno(self):
            return 123
    assert select.get_fileno(DummySocket()) == 123