Example #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'
Example #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'
Example #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'
Example #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'
Example #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'
Example #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'
Example #7
0
def test_get_fileno_of_an_int_works():
    assert select.get_fileno(123) == 123
Example #8
0
def test_get_fileno_of_a_socket_works():
    class DummySocket(object):
        def fileno(self):
            return 123

    assert select.get_fileno(DummySocket()) == 123
Example #9
0
def test_get_fileno_of_an_int_works():
    assert select.get_fileno(123) == 123
Example #10
0
def test_get_fileno_of_a_socket_works():
    class DummySocket(object):
        def fileno(self):
            return 123
    assert select.get_fileno(DummySocket()) == 123