def test_get_booktitle_not_in_proceedings():
    record = InspireRecord({})

    not_in_proceedings = Bibtex(record)
    not_in_proceedings.entry_type = 'not-inproceedings'
    not_in_proceedings.original_entry = 'not-inproceedings'

    assert not_in_proceedings._get_booktitle() is None
def test_get_booktitle_not_in_proceedings():
    record = Record({})

    not_in_proceedings = Bibtex(record)
    not_in_proceedings.entry_type = 'not-inproceedings'
    not_in_proceedings.original_entry = 'not-inproceedings'

    assert not_in_proceedings._get_booktitle() is None
def test_get_year_from_thesis_two_dates():
    record = Record({'thesis': [{'date': '2008'}, {'date': '2015'}]})

    thesis_two_dates = Bibtex(record)
    thesis_two_dates.original_entry = 'thesis'

    expected = '2015'
    result = thesis_two_dates._get_year()

    assert expected == result
def test_get_year_from_thesis_one_date():
    record = Record({'thesis': [{'date': '2008'}]})

    thesis_one_date = Bibtex(record)
    thesis_one_date.original_entry = 'thesis'

    expected = '2008'
    result = thesis_one_date._get_year()

    assert expected == result
def test_get_year_from_thesis_an_empty_list_but_imprints():
    record = Record({'imprints': [{'date': '2015-12-04'}], 'thesis': []})

    thesis_an_empty_list_but_imprints = Bibtex(record)
    thesis_an_empty_list_but_imprints.original_entry = 'thesis'

    expected = '2015'
    result = thesis_an_empty_list_but_imprints._get_year()

    assert expected == result
def test_get_year_from_thesis_an_empty_list_but_preprint_date():
    record = Record({'preprint_date': '1998-04-30', 'thesis': []})

    thesis_an_empty_list_but_preprint_date = Bibtex(record)
    thesis_an_empty_list_but_preprint_date.original_entry = 'thesis'

    expected = '1998'
    result = thesis_an_empty_list_but_preprint_date._get_year()

    assert expected == result
def test_get_year_from_thesis_an_empty_list():
    record = Record({'thesis': []})

    thesis_an_empty_list = Bibtex(record)
    thesis_an_empty_list.original_entry = 'thesis'

    expected = ''
    result = thesis_an_empty_list._get_year()

    assert expected == result
def test_get_year_from_thesis_one_date():
    record = InspireRecord({
        'thesis': {'date': '2008'}
    })

    thesis_one_date = Bibtex(record)
    thesis_one_date.original_entry = 'thesis'

    expected = '2008'
    result = thesis_one_date._get_year()

    assert expected == result
def test_get_year_from_thesis_an_empty_obj():
    record = InspireRecord({
        'thesis': {}
    })

    thesis_an_empty_list = Bibtex(record)
    thesis_an_empty_list.original_entry = 'thesis'

    expected = ''
    result = thesis_an_empty_list._get_year()

    assert expected == result
def test_get_year_from_thesis_an_empty_obj_but_imprints():
    record = InspireRecord({
        'imprints': [{'date': '2015-12-04'}],
        'thesis': {}
    })

    thesis_an_empty_list_but_imprints = Bibtex(record)
    thesis_an_empty_list_but_imprints.original_entry = 'thesis'

    expected = '2015'
    result = thesis_an_empty_list_but_imprints._get_year()

    assert expected == result
def test_get_year_from_thesis_an_empty_obj_but_preprint_date():
    record = InspireRecord({
        'preprint_date': '1998-04-30',
        'thesis': {}
    })

    thesis_an_empty_list_but_preprint_date = Bibtex(record)
    thesis_an_empty_list_but_preprint_date.original_entry = 'thesis'

    expected = '1998'
    result = thesis_an_empty_list_but_preprint_date._get_year()

    assert expected == result
def test_get_year_from_thesis_two_dates():
    record = Record({
        'thesis': [
            {'date': '2008'},
            {'date': '2015'}
        ]
    })

    thesis_two_dates = Bibtex(record)
    thesis_two_dates.original_entry = 'thesis'

    expected = '2015'
    result = thesis_two_dates._get_year()

    assert expected == result