def test_load_publications_with_accepted_publications():
    a = create_example_author(contrib=1.0)
    pubs = [
        create_example_publication(publication_id="1",
                                   contrib=0.5,
                                   accepted=True),
        create_example_publication(publication_id="2", contrib=69.0),
        create_example_publication(publication_id="3", contrib=1.0),
    ]
    a.load_publications(pubs)

    assert compare_lists(a.publications, pubs)
    assert compare_lists(a.accepted_publications, [pubs[0]])
def test_load_publications_with_publication_with_too_big_contrib_accepted():
    a = create_example_author(contrib=1.0)
    ctb = PUBLICATIONS_COEFFICIENT * a.get_contribution() + 1
    pubs = [
        create_example_publication(publication_id="1", contrib=0.5),
        create_example_publication(publication_id="2",
                                   contrib=ctb,
                                   accepted=True),
        create_example_publication(publication_id="3", contrib=1.0),
    ]
    a.load_publications(pubs)

    assert compare_lists(a.publications, pubs)
    assert compare_lists(a.accepted_publications, [])
Exemple #3
0
def test_prepare_authors():
    data = prepare_test_authors_data()
    authors = prepare_test_authors(data)

    prepared_authors = prepare_authors(data)

    assert compare_lists(authors, prepared_authors)
def test_get_accepted_publications():
    a = create_example_author()
    pubs = [
        create_example_publication(publication_id=str(i)) for i in range(5)
    ]
    a.accepted_publications = pubs
    assert compare_lists(a.get_accepted_publications(), pubs)
def test_accept_publication():
    a = create_example_author(contrib=4.0)
    pubs = [
        create_example_publication(publication_id=i, contrib=1)
        for i in range(3)
    ]
    a.load_publications(pubs)
    for pub in a.publications:
        assert a.accept_publication(pub)
    assert compare_lists(a.accepted_publications, pubs)
def test_load_publications():
    a = create_example_author(contrib=1.0)
    pubs = [
        create_example_publication(publication_id="1", contrib=0.5),
        create_example_publication(publication_id="2", contrib=69.0),
        create_example_publication(publication_id="3", contrib=1.0),
    ]
    a.load_publications(pubs)

    assert compare_lists(a.publications, pubs)
def test_get_pubs_to_considerate():
    a = create_example_author(contrib=1.0)
    pubs = [
        create_example_publication(publication_id="1",
                                   contrib=0.5,
                                   accepted=True),
        create_example_publication(publication_id="2", contrib=69.0),
        create_example_publication(publication_id="3", contrib=1.0),
    ]
    a.load_publications(pubs)

    assert compare_lists(a.get_pubs_to_considerate(), pubs[1:])
def test_accept_publication_with_multiple_publications():
    a = create_example_author(contrib=4.0)
    contrib = BASIC_CONTRIB_COEFFICIENT * 69
    pubs = [
        create_example_publication(publication_id="1", contrib=0.01),
        create_example_publication(publication_id="2", contrib=contrib),
        create_example_publication(publication_id="3", contrib=0.01),
    ]
    a.load_publications(pubs)
    assert a.accept_publication(pubs[0])
    assert not a.accept_publication(pubs[1])
    assert a.accept_publication(pubs[2])

    assert compare_lists(a.accepted_publications, [pubs[0], pubs[2]])
Exemple #9
0
def test_create_publications_list():
    ids, mons, points, ctbs = prepare_test_publications_data()
    pubs = prepare_test_publications(ids, mons, points, ctbs)

    result = create_publications_list(ids, mons, points, ctbs)
    assert compare_lists(result, pubs)
 def __eq__(self, other):
     return (self.id == other.id and self.is_phd == other.is_phd
             and self.is_emp == other.is_emp
             and self.contribution == other.contribution
             and self.in_n == other.in_n
             and compare_lists(self.publications, other.publications))