Exemple #1
0
def test_display_all(capsys, ads_entries):
    results = [ads_entries['fortney2018'], ads_entries['fortney2016']]
    start = 0
    index = 0
    rows = 2
    nmatch = 2
    am.display(results, start, index, rows, nmatch, short=True)
    captured = capsys.readouterr()
    assert captured.out == f"""
Exemple #2
0
def test_display_all(capsys, mock_init, ads_entries):
    results = [ads_entries['fortney2018'], ads_entries['fortney2016']]
    start = 0
    index = 0
    rows = 2
    nmatch = 2
    am.display(results, start, index, rows, nmatch, short=True)
    captured = capsys.readouterr()
    assert captured.out == \
        expected_output1 + 'Showing entries 1--2 out of 2 matches.\n'
Exemple #3
0
def test_display_over(capsys, mock_init, ads_entries):
    results = [
        ads_entries['fortney2018'], ads_entries['fortney2016'],
        ads_entries['fortney2013'], ads_entries['fortney2012']
    ]
    start = 0
    index = 3
    rows = 2
    nmatch = 4
    am.display(results, start, index, rows, nmatch, short=True)
    captured = capsys.readouterr()
    expected_output = '\x1b[0m\x1b[?7h\x1b[0m\r\n\x1b[0;38;5;33mTitle\x1b[0m: \x1b[0;38;5;130mOn the Carbon-to-oxygen Ratio Measurement in nearby Sun-like Stars:\r\n    Implications for Planet Formation and the Determination of Stellar\r\n    Abundances\x1b[0m\r\n\x1b[0;38;5;33mAuthors\x1b[0m: \x1b[0;38;5;130mFortney, Jonathan J.\x1b[0m\r\n\x1b[0;38;5;33mADS URL\x1b[0m: \x1b[0;38;5;130mhttps://ui.adsabs.harvard.edu/abs/2012ApJ...747L..27F\x1b[0m\r\n\x1b[0;38;5;33mbibcode\x1b[0m: \x1b[0;38;5;142m2012ApJ...747L..27F\x1b[0m\r\n\x1b[0m\nShowing entries 4--4 out of 4 matches.\n'
    assert captured.out == expected_output
Exemple #4
0
def test_display_second_batch(capsys, mock_init, ads_entries):
    results = [
        ads_entries['fortney2018'], ads_entries['fortney2016'],
        ads_entries['fortney2013'], ads_entries['fortney2012']
    ]
    start = 0
    index = 2
    rows = 2
    nmatch = 4
    am.display(results, start, index, rows, nmatch, short=True)
    captured = capsys.readouterr()
    assert captured.out == \
        expected_output2 + 'Showing entries 3--4 out of 4 matches.\n'
Exemple #5
0
def test_display_first_batch(capsys, mock_init, ads_entries):
    results = [
        ads_entries['fortney2018'], ads_entries['fortney2016'],
        ads_entries['fortney2013'], ads_entries['fortney2012']
    ]
    start = 0
    index = 0
    rows = 2
    nmatch = 4
    am.display(results, start, index, rows, nmatch, short=True)
    captured = capsys.readouterr()
    assert captured.out == (
        expected_output1 + 'Showing entries 1--2 out of 4 matches.  '
        'To show the next set, execute:\nbibm ads-search -n\n')