def test_create_journal_kb_file_handles_malformed_title_variants(jhep_with_malformed_title, tmpdir):
    journal_kb_fd = tmpdir.join('journal-titles.kb')

    config = {'REFEXTRACT_JOURNAL_KB_PATH': str(journal_kb_fd)}

    with patch.dict(current_app.config, config):
        create_journal_kb_file()

    journal_kb = journal_kb_fd.read().splitlines()

    assert '---JHEP' not in journal_kb
def test_create_journal_kb_file(app):
    temporary_fd, path = mkstemp()
    config = {'REFEXTRACT_JOURNAL_KB_PATH': path}

    with patch.dict(current_app.config, config):
        create_journal_kb_file()

    with open(path, 'r') as fd:
        assert 'JOURNAL OF HIGH ENERGY PHYSICS---JHEP' in fd.read()

    os.close(temporary_fd)
    os.remove(path)
def test_create_journal_kb_file_handles_malformed_title_variants(
        jhep_with_malformed_title, tmpdir):
    journal_kb_fd = tmpdir.join('journal-titles.kb')

    config = {'REFEXTRACT_JOURNAL_KB_PATH': str(journal_kb_fd)}

    with patch.dict(current_app.config, config):
        create_journal_kb_file()

    journal_kb = journal_kb_fd.read().splitlines()

    assert '---JHEP' not in journal_kb
def test_create_journal_kb_file_handles_malformed_title_variants(jhep_with_malformed_title):
    temporary_fd, path = mkstemp()
    config = {'REFEXTRACT_JOURNAL_KB_PATH': path}

    with patch.dict(current_app.config, config):
        create_journal_kb_file()

    with open(path, 'r') as fd:
        journal_kb = fd.read().splitlines()

        assert '---JHEP' not in journal_kb

    os.close(temporary_fd)
    os.remove(path)
Exemplo n.º 5
0
def test_create_journal_kb_file_handles_malformed_title_variants(jhep_with_malformed_title):
    temporary_fd, path = mkstemp()
    config = {'REFEXTRACT_JOURNAL_KB_PATH': path}

    with patch.dict(current_app.config, config):
        create_journal_kb_file()

    with open(path, 'r') as fd:
        journal_kb = fd.read().splitlines()

        assert '---JHEP' not in journal_kb

    os.close(temporary_fd)
    os.remove(path)
def test_create_journal_kb_file(app, tmpdir):
    journal_kb_fd = tmpdir.join('journal-titles.kb')

    config = {'REFEXTRACT_JOURNAL_KB_PATH': str(journal_kb_fd)}

    with patch.dict(current_app.config, config):
        create_journal_kb_file()

    journal_kb = journal_kb_fd.read().splitlines()

    # short_title -> short_title
    assert 'JHEP---JHEP' in journal_kb

    # journal_title.title -> short_title, normalization is applied
    assert 'THE JOURNAL OF HIGH ENERGY PHYSICS JHEP---JHEP' in journal_kb

    # title_variants -> short_title
    assert 'JOURNAL OF HIGH ENERGY PHYSICS---JHEP' in journal_kb
def test_create_journal_kb_file(app, tmpdir):
    journal_kb_fd = tmpdir.join('journal-titles.kb')

    config = {'REFEXTRACT_JOURNAL_KB_PATH': str(journal_kb_fd)}

    with patch.dict(current_app.config, config):
        create_journal_kb_file()

    journal_kb = journal_kb_fd.read().splitlines()

    # short_title -> short_title
    assert 'JHEP---JHEP' in journal_kb

    # journal_title.title -> short_title, normalization is applied
    assert 'THE JOURNAL OF HIGH ENERGY PHYSICS JHEP---JHEP' in journal_kb

    # title_variants -> short_title
    assert 'JOURNAL OF HIGH ENERGY PHYSICS---JHEP' in journal_kb
def test_create_journal_kb_file(app):
    temporary_fd, path = mkstemp()
    config = {'REFEXTRACT_JOURNAL_KB_PATH': path}

    with patch.dict(current_app.config, config):
        create_journal_kb_file()

    with open(path, 'r') as fd:
        journal_kb = fd.read().splitlines()

        assert 'JHEP---JHEP' in journal_kb
        '''short_title -> short_title'''

        assert 'THE JOURNAL OF HIGH ENERGY PHYSICS JHEP---JHEP' in journal_kb
        '''journal_title.title -> short_title, normalization is applied'''

        assert 'JOURNAL OF HIGH ENERGY PHYSICS---JHEP' in journal_kb
        '''title_variants -> short_title'''

    os.close(temporary_fd)
    os.remove(path)
Exemplo n.º 9
0
def test_create_journal_kb_file(app):
    temporary_fd, path = mkstemp()
    config = {'REFEXTRACT_JOURNAL_KB_PATH': path}

    with patch.dict(current_app.config, config):
        create_journal_kb_file()

    with open(path, 'r') as fd:
        journal_kb = fd.read().splitlines()

        assert 'JHEP---JHEP' in journal_kb
        '''short_title -> short_title'''

        assert 'THE JOURNAL OF HIGH ENERGY PHYSICS JHEP---JHEP' in journal_kb
        '''journal_title.title -> short_title, normalization is applied'''

        assert 'JOURNAL OF HIGH ENERGY PHYSICS---JHEP' in journal_kb
        '''title_variants -> short_title'''

    os.close(temporary_fd)
    os.remove(path)