Пример #1
0
def test_main_plot_to_file(monkeypatch, capsys, tmpdir):
    tmpdir = Path(tmpdir)
    pngfile = tmpdir / "test.png"
    monkeypatch.setattr(sys, "argv",
                        ["oeis", "A000290", "--file",
                         str(pngfile)])
    oeis.main()
    assert pngfile.exists()
Пример #2
0
def test_main(monkeypatch, capsys):
    monkeypatch.setattr(sys, "argv", ["oeis"])
    with pytest.raises(SystemExit):
        oeis.main()
    captured = capsys.readouterr()
    assert "--help" in captured.err
Пример #3
0
def test_main_start_out_of_bound_due_to_offset(monkeypatch, capsys):
    monkeypatch.setattr(sys, "argv", ["oeis", "A001462", "--start", "0"])
    with pytest.raises(SystemExit):
        oeis.main()
    assert "offset" in capsys.readouterr().err
Пример #4
0
def test_main_random(monkeypatch, capsys):
    monkeypatch.setattr(sys, "argv", ["oeis", "--random"])
    oeis.main()
    captured = capsys.readouterr()
    assert "A" in captured.out
Пример #5
0
def test_main_list(monkeypatch, capsys):
    monkeypatch.setattr(sys, "argv", ["oeis", "--list"])
    oeis.main()
    captured = capsys.readouterr()
    assert "A00" in captured.out
Пример #6
0
def test_main_unimplemented(monkeypatch, capsys):
    monkeypatch.setattr(sys, "argv", ["oeis", "APOUETTE"])
    with pytest.raises(SystemExit):
        oeis.main()
    captured = capsys.readouterr()
    assert "Unimplemented" in captured.err