Config_test.py 文件源码

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

项目:diffios 作者: robphoenix 项目源码 文件源码
def test_ignore_lines_from_file(ignores_file):
    """
    Should return the lines in the given ignores file as list of lowercase strings.
    """
    config = ['hostname ROUTER']
    expected = ignores_file.lower().split('\n')
    ignores_data = mock.mock_open(read_data=ignores_file)
    with mock.patch('diffios.config.os.path.isfile') as mock_isfile:
        mock_isfile.return_value = True
        with mock.patch(
                'diffios.config.open', ignores_data, create=True) as mock_open:
            actual = diffios.Config(
                config, ignore_lines='ignores_file').ignore_lines
            mock_open.assert_called_once_with('ignores_file')
            assert expected == actual
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号