Esempio 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
Esempio 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']
Esempio n. 4
0
def test_thesis_supervisors_from_supervisors():
    form = GroupableOrderedDict([
        ('supervisors', 'foo'),
    ])

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

    assert expected == result['thesis_supervisors']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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',
    }]
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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',
        },
    ]
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']
Esempio 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']