def test_write():
''' Test fs.write() works. '''
filename = 'somefile'
data = 'somedata'
m = mock_open()
with patch('__builtin__.open', m) as mock_file:
fs.write(filename, data)
mock_file.assert_called_with(filename, 'w')
m().write.assert_called_with(data)
评论列表
文章目录