Beispiel #1
0
    def test_Entry(self):
        from pyglottolog.references import Entry

        self.assertEqual(Entry.lgcodes(None), [])
        e = Entry(
            'x', 'misc', {'hhtype': 'grammar (computerized assignment from "xyz")'}, None)
        self.assertEqual(e.doctypes({'grammar': 1}), ([1], 'xyz'))
Beispiel #2
0
def test_Entry_publisher_and_address(publisher, address, p_and_a):
    e = Entry('x', 'misc', dict(publisher=publisher, address=address), None)
    assert e.publisher_and_address == p_and_a
Beispiel #3
0
def test_Entry_weight(smaller, bigger, mocker):
    a = Entry('x', 'misc', smaller, mocker.Mock())
    b = Entry('x', 'misc', bigger, mocker.Mock())
    assert a < b
    assert a != b
Beispiel #4
0
def test_Entry_lgcodes():
    assert Entry.lgcodes(None) == []
Beispiel #5
0
def entry():
    return Entry('x', 'misc', {'hhtype': 'grammar (computerized assignment from "xyz")'}, None)
Beispiel #6
0
def test_Entry_pages_int(fields, expected):
    e = Entry('x', 'misc', fields, None)
    assert e.pages_int == expected
Beispiel #7
0
def test_Entry_med(fields, expected, mocker, api):
    e = Entry('x', 'misc', fields, mocker.Mock(), api=api)
    assert e.med_type == api.med_types.get(expected)
Beispiel #8
0
def test_Entry_weight_with_api(api, mocker):
    assert Entry('x', 'misc', dict(hhtype='grammar'), mocker.Mock(), api) > \
           Entry('x', 'misc', dict(hhtype='other'), mocker.Mock(), api)