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

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