def test_main(files_mock, sys_mock, *args): # So the checkers mock supports iteration. mock = Mock() Mock.__iter__ = lambda *args: iter([mock]) files = ["foo", "bar"] files_mock.return_value = files sys_mock.argv = [Mock()] check._main() mock.assert_called_with(files)
def test_main(files_mock, sys_mock, *args): # So the checkers mock supports iteration. mock = Mock() Mock.__iter__ = lambda *args: iter([mock]) files = ['foo', 'bar'] files_mock.return_value = files sys_mock.argv = [Mock()] check._main() mock.assert_called_with(files)
def test_main_with_args(sys_mock, isfile_mock, walkfiles_mock, *args): # So the checkers mock supports iteration. mock = Mock() Mock.__iter__ = lambda *args: iter([mock]) sys_mock.argv = ["./check", "foo", "bar"] isfile_mock.return_value = True check._main() mock.assert_called_with(["foo", "bar"]) mock.reset() isfile_mock.return_value = False walkfiles_mock.return_value = ["bar~", "bla.py"] check._main() mock.assert_called_with(["bla.py"])
def test_main_with_args(sys_mock, isfile_mock, walkfiles_mock, *args): # So the checkers mock supports iteration. mock = Mock() Mock.__iter__ = lambda *args: iter([mock]) sys_mock.argv = ['./check', 'foo', 'bar'] isfile_mock.return_value = True check._main() mock.assert_called_with(['foo', 'bar']) mock.reset() isfile_mock.return_value = False walkfiles_mock.return_value = ['bar~', 'bla.py'] check._main() mock.assert_called_with(['bla.py'])