Exemplo n.º 1
0
def test_languages_from_language_english_or_other():
    form = {
        'language': 'en',
    }

    result = literature.do(form)

    assert 'languages' not in result
def test_languages_from_language_english_or_other():
    form = {
        'language': 'en',
    }

    result = literature.do(form)

    assert 'languages' not in result
Exemplo n.º 3
0
def test_thesis_university_from_institution():
    form = GroupableOrderedDict([
        ('institution', 'foo'),
    ])

    expected = {'institutions': [{'name': 'foo'}]}
    result = literature.do(form)

    assert expected == result['thesis']
Exemplo n.º 4
0
def test_thesis_supervisors_from_supervisors():
    form = GroupableOrderedDict([
        ('supervisors', 'foo'),
    ])

    expected = 'foo'
    result = literature.do(form)

    assert expected == result['thesis_supervisors']
Exemplo n.º 5
0
def test_thesis_date_from_thesis_date():
    form = GroupableOrderedDict([
        ('thesis_date', 'foo'),
    ])

    expected = {'date': 'foo'}
    result = literature.do(form)

    assert expected == result['thesis']
def test_thesis_supervisor_from_supervisors():
    form = GroupableOrderedDict([
        ('supervisors', 'foo'),
    ])

    expected = 'foo'
    result = literature.do(form)

    assert expected == result['thesis_supervisor']
Exemplo n.º 7
0
def test_thesis_institution_from_multiple_institution_updates():
    form = GroupableOrderedDict([
        ('institution', 'foo'),
        ('institution', 'bar'),
    ])

    expected = {'institutions': [{'name': 'bar'}]}
    result = literature.do(form)

    assert expected == result['thesis']
def test_thesis_university_from_institution():
    form = GroupableOrderedDict([
        ('institution', 'foo'),
    ])

    expected = {
        'institutions': [{'name': 'foo'}]
    }
    result = literature.do(form)

    assert expected == result['thesis']
def test_thesis_degree_type_from_degree_type():
    form = GroupableOrderedDict([
        ('degree_type', 'foo'),
    ])

    expected = {
            'degree_type': 'foo',
    }
    result = literature.do(form)

    assert expected == result['thesis']
def test_thesis_date_from_thesis_date():
    form = GroupableOrderedDict([
        ('thesis_date', 'foo'),
    ])

    expected = {
        'date': 'foo'
    }
    result = literature.do(form)

    assert expected == result['thesis']
Exemplo n.º 11
0
def test_languages_from_language_not_english_or_other():
    form = {
        'language': 'ita',
    }

    expected = [
        u'Italian',
    ]
    result = literature.do(form)

    assert expected == result['languages']
Exemplo n.º 12
0
def test_thesis_degree_type_from_degree_type():
    form = GroupableOrderedDict([
        ('degree_type', 'foo'),
    ])

    expected = {
        'degree_type': 'foo',
    }
    result = literature.do(form)

    assert expected == result['thesis']
def test_languages_from_language_not_english_or_other():
    form = {
        'language': 'ita',
    }

    expected = [
        u'Italian',
    ]
    result = literature.do(form)

    assert expected == result['languages']
def test_thesis_institution_from_multiple_institution_updates():
    form = GroupableOrderedDict([
        ('institution', 'foo'),
        ('institution', 'bar'),
    ])

    expected = {
        'institutions': [{'name': 'bar'}]
    }
    result = literature.do(form)

    assert expected == result['thesis']
def test_title_translations_from_title_translation():
    form = GroupableOrderedDict([
        ('title_translation', 'foo'),
    ])

    expected = [
        {
            'title': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['title_translations']
def test_hidden_notes_from_hidden_note():
    form = {
        'hidden_note': 'foo',
    }

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['hidden_notes']
def test_publication_info_cnum_from_conference_id():
    form = GroupableOrderedDict([
        ('conference_id', 'foo'),
    ])

    expected = [
        {
            'cnum': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
def test_abstracts_from_abstract():
    form = GroupableOrderedDict([
        ('abstract', 'foo bar baz'),
    ])

    expected = [
        {
            'value': 'foo bar baz',
        },
    ]
    result = literature.do(form)

    assert expected == result['abstracts']
def test_imprints_date_from_preprint_created():
    form = GroupableOrderedDict([
        ('preprint_created', 'foo'),
    ])

    expected = [
        {
            'date': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['imprints']
def test_public_notes_from_note():
    form = GroupableOrderedDict([
        ('note', 'foo'),
    ])

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['public_notes']
def test_license_from_license_url():
    form = GroupableOrderedDict([
        ('license_url', 'foo'),
    ])

    expected = [
        {
            'url': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['license']
Exemplo n.º 22
0
def test_imprints_date_from_preprint_created():
    form = GroupableOrderedDict([
        ('preprint_created', 'foo'),
    ])

    expected = [
        {
            'date': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['imprints']
Exemplo n.º 23
0
def test_publication_info_cnum_from_conference_id():
    form = GroupableOrderedDict([
        ('conference_id', 'foo'),
    ])

    expected = [
        {
            'cnum': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
Exemplo n.º 24
0
def test_collaboration_from_collaboration():
    form = {
        'collaboration': 'foo',
    }

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['collaboration']
def test_urls_and_pdf_from_url():
    form = GroupableOrderedDict([
        ('url', 'foo'),
    ])

    result = literature.do(form)

    assert result['pdf'] == 'foo'
    assert result['urls'] == [
        {
            'value': 'foo',
        },
    ]
def test_accelerator_experiments_from_experiment():
    form = GroupableOrderedDict([
        ('experiment', 'foo'),
    ])

    expected = [
        {
            'experiment': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['accelerator_experiments']
def test_abstracts_from_abstract_strips_spaces():
    form = GroupableOrderedDict([
        ('abstract', '    bar    '),
    ])

    expected = [
        {
            'value': 'bar',
        },
    ]
    result = literature.do(form)

    assert expected == result['abstracts']
def test_urls_from_additional_url():
    form = GroupableOrderedDict([
        ('additional_url', 'foo'),
    ])

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['urls']
def test_publication_info_journal_volume_from_volume():
    form = GroupableOrderedDict([
        ('volume', 'foo'),
    ])

    expected = [
        {
            'journal_volume': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
def test_collaboration_from_collaboration():
    form = {
        'collaboration': 'foo',
    }

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['collaboration']
def test_publication_info_year_from_year():
    form = GroupableOrderedDict([
        ('year', 'foo'),
    ])

    expected = [
        {
            'year': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
Exemplo n.º 32
0
def test_hidden_notes_from_hidden_note():
    form = {
        'hidden_note': 'foo',
    }

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['hidden_notes']
def test_publication_info_page_artid_from_page_range_article_id():
    form = GroupableOrderedDict([
        ('page_range_article_id', 'foo'),
    ])

    expected = [
        {
            'artid': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
Exemplo n.º 34
0
def test_abstracts_from_abstract():
    form = GroupableOrderedDict([
        ('abstract', 'foo bar baz'),
    ])

    expected = [
        {
            'value': 'foo bar baz',
        },
    ]
    result = literature.do(form)

    assert expected == result['abstracts']
def test_arxiv_eprints_from_arxiv_id_post_2007():
    form = GroupableOrderedDict([
        ('arxiv_id', '1407.7581v1'),
    ])

    expected = [
        {
            'value': 'arXiv:1407.7581v1',
        },
    ]
    result = literature.do(form)

    assert expected == result['arxiv_eprints']
Exemplo n.º 36
0
def test_thesis_defense_date_and_public_notes_from_defense_date():
    form = GroupableOrderedDict([
        ('defense_date', 'foo'),
    ])

    result = literature.do(form)

    assert result['thesis'] == {
        'defense_date': 'foo',
    }
    assert result['public_notes'] == [{
        'value': 'Presented on foo',
    }]
Exemplo n.º 37
0
def test_dois_from_doi():
    form = GroupableOrderedDict([
        ('doi', 'foo'),
    ])

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['dois']
def test_dois_from_doi():
    form = GroupableOrderedDict([
        ('doi', 'foo'),
    ])

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['dois']
Exemplo n.º 39
0
def test_title_translations_from_title_translation():
    form = GroupableOrderedDict([
        ('title_translation', 'foo'),
    ])

    expected = [
        {
            'title': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['title_translations']
Exemplo n.º 40
0
def test_license_from_license_url():
    form = GroupableOrderedDict([
        ('license_url', 'foo'),
    ])

    expected = [
        {
            'url': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['license']
Exemplo n.º 41
0
def test_arxiv_eprints_from_arxiv_id_post_2007():
    form = GroupableOrderedDict([
        ('arxiv_id', '1407.7581v1'),
    ])

    expected = [
        {
            'value': 'arXiv:1407.7581v1',
        },
    ]
    result = literature.do(form)

    assert expected == result['arxiv_eprints']
Exemplo n.º 42
0
def test_urls_from_additional_url():
    form = GroupableOrderedDict([
        ('additional_url', 'foo'),
    ])

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['urls']
Exemplo n.º 43
0
def test_publication_info_year_from_year():
    form = GroupableOrderedDict([
        ('year', 'foo'),
    ])

    expected = [
        {
            'year': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
Exemplo n.º 44
0
def test_publication_info_page_artid_from_page_range_article_id():
    form = GroupableOrderedDict([
        ('page_range_article_id', 'foo'),
    ])

    expected = [
        {
            'artid': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
Exemplo n.º 45
0
def test_abstracts_from_abstract_strips_spaces():
    form = GroupableOrderedDict([
        ('abstract', '    bar    '),
    ])

    expected = [
        {
            'value': 'bar',
        },
    ]
    result = literature.do(form)

    assert expected == result['abstracts']
Exemplo n.º 46
0
def test_publication_info_journal_volume_from_volume():
    form = GroupableOrderedDict([
        ('volume', 'foo'),
    ])

    expected = [
        {
            'journal_volume': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
Exemplo n.º 47
0
def test_accelerator_experiments_from_experiment():
    form = GroupableOrderedDict([
        ('experiment', 'foo'),
    ])

    expected = [
        {
            'experiment': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['accelerator_experiments']
Exemplo n.º 48
0
def test_public_notes_from_note():
    form = GroupableOrderedDict([
        ('note', 'foo'),
    ])

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['public_notes']
Exemplo n.º 49
0
def test_urls_and_pdf_from_url():
    form = GroupableOrderedDict([
        ('url', 'foo'),
    ])

    result = literature.do(form)

    assert result['pdf'] == 'foo'
    assert result['urls'] == [
        {
            'value': 'foo',
        },
    ]
Exemplo n.º 50
0
def test_publication_info_journal_title_from_multiple_journal_title_updates():
    form = GroupableOrderedDict([
        ('journal_title', 'foo'),
        ('journal_title', 'bar'),
    ])

    expected = [
        {
            'journal_title': 'bar',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
def test_arxiv_eprints_from_arxiv_id_pre_2007():
    form = GroupableOrderedDict([
        ('arxiv_id', 'math.GT/0309136'),
    ])

    expected = [
        {
            'categories': 'math.GT',
            'value': 'math.GT/0309136',
        },
    ]
    result = literature.do(form)

    assert expected == result['arxiv_eprints']
def test_publication_info_journal_title_from_multiple_journal_title_updates():
    form = GroupableOrderedDict([
        ('journal_title', 'foo'),
        ('journal_title', 'bar'),
    ])

    expected = [
        {
            'journal_title': 'bar',
        },
    ]
    result = literature.do(form)

    assert expected == result['publication_info']
Exemplo n.º 53
0
def test_arxiv_eprints_from_arxiv_id_pre_2007():
    form = GroupableOrderedDict([
        ('arxiv_id', 'math.GT/0309136'),
    ])

    expected = [
        {
            'categories': 'math.GT',
            'value': 'math.GT/0309136',
        },
    ]
    result = literature.do(form)

    assert expected == result['arxiv_eprints']
def test_thesis_defense_date_and_public_notes_from_defense_date():
    form = GroupableOrderedDict([
        ('defense_date', 'foo'),
    ])

    result = literature.do(form)

    assert result['thesis'] == {
        'defense_date': 'foo',
    }
    assert result['public_notes'] == [
        {
            'value': 'Presented on foo',
        }
    ]
def test_report_numbers_from_report_numbers():
    form = {
        'report_numbers': [
            {
                'report_number': 'foo',
            },
        ],
    }

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['report_numbers']
def test_titles_from_multiple_title():
    form = GroupableOrderedDict([
        ('title', 'foo'),
        ('title', 'bar'),
    ])

    expected = [
        {
            'title': 'foo',
        },
        {
            'title': 'bar',
        },
    ]
    result = literature.do(form)

    assert expected == result['titles']
Exemplo n.º 57
0
def test_titles_from_multiple_title():
    form = GroupableOrderedDict([
        ('title', 'foo'),
        ('title', 'bar'),
    ])

    expected = [
        {
            'title': 'foo',
        },
        {
            'title': 'bar',
        },
    ]
    result = literature.do(form)

    assert expected == result['titles']
Exemplo n.º 58
0
def test_report_numbers_from_report_numbers():
    form = {
        'report_numbers': [
            {
                'report_number': 'foo',
            },
        ],
    }

    expected = [
        {
            'value': 'foo',
        },
    ]
    result = literature.do(form)

    assert expected == result['report_numbers']
Exemplo n.º 59
0
def test_arxiv_eprints_from_multiple_arxiv_id():
    form = GroupableOrderedDict([
        ('arxiv_id', '1501.00001v1'),
        ('arxiv_id', '0706.0001v2'),
    ])

    expected = [
        {
            'value': 'arXiv:1501.00001v1',
        },
        {
            'value': 'arXiv:0706.0001v2',
        },
    ]
    result = literature.do(form)

    assert expected == result['arxiv_eprints']
def test_arxiv_eprints_from_multiple_arxiv_id():
    form = GroupableOrderedDict([
        ('arxiv_id', '1501.00001v1'),
        ('arxiv_id', '0706.0001v2'),
    ])

    expected = [
        {
            'value': 'arXiv:1501.00001v1',
        },
        {
            'value': 'arXiv:0706.0001v2',
        },
    ]
    result = literature.do(form)

    assert expected == result['arxiv_eprints']