Beispiel #1
0
def test_del():
    files.open = Mock()
    bf = files.BaseFile("filename", 'r')
    close_mock = Mock()
    bf.close = close_mock
    del bf
    close_mock.assert_called_with()
    files.open = builtin_open
Beispiel #2
0
def test_close():
    files.open = Mock()
    bf = files.BaseFile("filename", 'r')
    bf.close()
    bf.fileobj.close.assert_called_with()
    files.open = builtin_open
Beispiel #3
0
def test_create_BaseFile():
    files.open = Mock()
    bf = files.BaseFile("filename", 'r')
    files.open.assert_called_with("filename", "r", files.DEFAULT_BUFFER_SIZE)
    files.open = builtin_open