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))
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)
def test_oeis_does_not_exist(number): assert not oeis.exists(number)
def test_oeis_exists(index): if oeis.client.entry(index): assert oeis.exists(index) if oeis.client.exists(index): assert oeis.entry(index)
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)
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)