Ejemplo n.º 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'))
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 4
0
def test_Entry_lgcodes():
    assert Entry.lgcodes(None) == []
Ejemplo n.º 5
0
def entry():
    return Entry('x', 'misc', {'hhtype': 'grammar (computerized assignment from "xyz")'}, None)
Ejemplo n.º 6
0
def test_Entry_pages_int(fields, expected):
    e = Entry('x', 'misc', fields, None)
    assert e.pages_int == expected
Ejemplo n.º 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)
Ejemplo n.º 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)