コード例 #1
0
def test_oeis_b_file(index):
    if oeis.exists(index):
        content = oeis.bfile(index, check_name=True)
        assert isinstance(content, BoxObject)
        assert isinstance(content, tuple)
    else:
        pytest.skip("Missing OEIS Index: {}.".format(index))
コード例 #2
0
def test_sequence_loading(factory, names):
    for name in names:
        meta = factory.load_meta(name)
        if not oeis.exists(name):
            assert isinstance(meta, BoxObject)
            assert meta == None
        else:
            assert isinstance(meta, Box)
            assert isinstance(meta.raw, dict)
            entry = factory.load(name)
            assert entry == Sequence.from_dict(meta)
コード例 #3
0
def test_oeis_does_not_exist(number):
    assert not oeis.exists(number)
コード例 #4
0
def test_oeis_exists(index):
    if oeis.client.entry(index):
        assert oeis.exists(index)
    if oeis.client.exists(index):
        assert oeis.entry(index)
コード例 #5
0
def test_session_entry(index, session):
    name = oeis.name(index)
    assert oeis.exists(name, check_name=False) == session.exists(name, check_name=False)
    assert oeis.entry(name, check_name=False) == session.entry(name, check_name=False)
    assert oeis.bfile(name, check_name=False) == session.bfile(name, check_name=False)
コード例 #6
0
def test_missing_id(index):
    if not oeis.exists(index):
        with pytest.raises(oeis.MissingID, match=match_with(index)):
            oeis.A(index)
    else:
        assert oeis.A(index)