コード例 #1
0
def ingest_hlom():

    """
    Ingest HLOM texts.
    """

    Text.ingest_hlom()
コード例 #2
0
def test_require_title_and_author(title, author, mock_hlom):
    """
    Skip records that don't have a query-able title and author.
    """

    mock_hlom.add_marc(title=title, author=author)
    Text.ingest_hlom()

    assert Text.select().count() == 0
コード例 #3
0
def test_require_title_and_author(title, author, mock_hlom):

    """
    Skip records that don't have a query-able title and author.
    """

    mock_hlom.add_marc(title=title, author=author)
    Text.ingest_hlom()

    assert Text.select().count() == 0
コード例 #4
0
def test_load_multiple(mock_hlom):
    """
    Text.ingest_hlom() should ingest multiple records.
    """

    # 100 records.
    for i in range(100):
        mock_hlom.add_marc()

    Text.ingest_hlom()

    # 100 rows.
    assert Text.select().count() == 100
コード例 #5
0
def test_load_multiple(mock_hlom):

    """
    Text.ingest_hlom() should ingest multiple records.
    """

    # 100 records.
    for i in range(100):
        mock_hlom.add_marc()

    Text.ingest_hlom()

    # 100 rows.
    assert Text.select().count() == 100
コード例 #6
0
def test_set_identifier(mock_hlom):

    mock_hlom.add_marc(control_number='001')
    Text.ingest_hlom()

    assert Text.select().first().identifier == '001'
コード例 #7
0
def test_set_identifier(mock_hlom):

    mock_hlom.add_marc(control_number='001')
    Text.ingest_hlom()

    assert Text.select().first().identifier == '001'
コード例 #8
0
def test_set_corpus(mock_hlom):

    mock_hlom.add_marc()
    Text.ingest_hlom()

    assert Text.select().first().corpus == 'hlom'
コード例 #9
0
def test_set_date(mock_hlom):

    mock_hlom.add_marc(pubyear='1987')
    Text.ingest_hlom()

    assert Text.select().first().date == '1987'
コード例 #10
0
def test_set_publisher(mock_hlom):

    mock_hlom.add_marc(publisher='Chicago Press')
    Text.ingest_hlom()

    assert Text.select().first().publisher == 'Chicago Press'
コード例 #11
0
def test_set_authors(mock_hlom):

    mock_hlom.add_marc(author='David W. McClure')
    Text.ingest_hlom()

    assert Text.select().first().authors == ['David W. McClure']
コード例 #12
0
def test_set_surname(mock_hlom):

    mock_hlom.add_marc(author='McClure, David W.')
    Text.ingest_hlom()

    assert Text.select().first().surname == 'McClure'
コード例 #13
0
def test_set_title(mock_hlom):

    mock_hlom.add_marc(title='Book Title')
    Text.ingest_hlom()

    assert Text.select().first().title == 'Book Title'
コード例 #14
0
def test_set_corpus(mock_hlom):

    mock_hlom.add_marc()
    Text.ingest_hlom()

    assert Text.select().first().corpus == 'hlom'
コード例 #15
0
def test_set_date(mock_hlom):

    mock_hlom.add_marc(pubyear='1987')
    Text.ingest_hlom()

    assert Text.select().first().date == '1987'
コード例 #16
0
def test_set_publisher(mock_hlom):

    mock_hlom.add_marc(publisher='Chicago Press')
    Text.ingest_hlom()

    assert Text.select().first().publisher == 'Chicago Press'
コード例 #17
0
def test_set_authors(mock_hlom):

    mock_hlom.add_marc(author='David W. McClure')
    Text.ingest_hlom()

    assert Text.select().first().authors == ['David W. McClure']
コード例 #18
0
def test_set_surname(mock_hlom):

    mock_hlom.add_marc(author='McClure, David W.')
    Text.ingest_hlom()

    assert Text.select().first().surname == 'McClure'
コード例 #19
0
def test_set_title(mock_hlom):

    mock_hlom.add_marc(title='Book Title')
    Text.ingest_hlom()

    assert Text.select().first().title == 'Book Title'