Пример #1
0
def test_language_warning(caplog):
    opts = make_opts(language=None)
    caplog.set_level(logging.DEBUG)
    with patch('ocrmypdf._validation.locale.getlocale',
               return_value=('en_US', 'UTF-8')):
        vd.check_options_languages(opts)
        assert opts.language == ['eng']
        assert '' in caplog.text

    opts = make_opts(language=None)
    with patch('ocrmypdf._validation.locale.getlocale',
               return_value=('fr_FR', 'UTF-8')):
        vd.check_options_languages(opts)
        assert opts.language == ['eng']
        assert 'assuming --language' in caplog.text
Пример #2
0
def test_language_warning(caplog):
    opts = make_opts(language=None)
    _plugin_manager = get_plugin_manager(opts.plugins)
    caplog.set_level(logging.DEBUG)
    with patch('ocrmypdf._validation.locale.getlocale',
               return_value=('en_US', 'UTF-8')) as mock:
        vd.check_options_languages(opts, {'eng'})
        assert opts.languages == {'eng'}
        assert '' in caplog.text
        mock.assert_called_once()

    opts = make_opts(language=None)
    with patch('ocrmypdf._validation.locale.getlocale',
               return_value=('fr_FR', 'UTF-8')) as mock:
        vd.check_options_languages(opts, {'eng'})
        assert opts.languages == {'eng'}
        assert 'assuming --language' in caplog.text
        mock.assert_called_once()