test_path.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:scarlett_os 作者: bossjones 项目源码 文件源码
def test_fname_exists_false(self, path_mocker_stopall):
        # mock
        mock_path = path_mocker_stopall.MagicMock(name="mock_path")
        # patch
        path_mocker_stopall.patch.object(scarlett_os.internal.path, 'Path', mock_path)

        path = '/home/pi/dev/bossjones-github/scarlett_os/_debug/generator.dot'

        mock_path_instance = mock_path()

        mock_path_instance.exists.return_value = False

        # run test
        result = s_path.fname_exists(path)

        assert mock_path_instance.exists.call_count == 1
        mock_path_instance.exists.assert_called_once_with()
        mock_path.assert_any_call(path)
        assert result == False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号