|
2 | 2 | # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
|
3 | 3 | # information.
|
4 | 4 |
|
5 |
| -import itertools |
6 | 5 | import tempfile
|
7 | 6 | from datetime import date
|
8 | 7 | from os.path import join
|
|
23 | 22 | TC5B_TERM = "Miniprotein Construct TC5b"
|
24 | 23 |
|
25 | 24 |
|
26 |
| -@pytest.mark.skipif(cannot_connect_to(RCSB_URL), reason="RCSB PDB is not available") |
| 25 | +@pytest.mark.parametrize("as_file_like", [False, True]) |
27 | 26 | @pytest.mark.parametrize(
|
28 |
| - "format, as_file_like", |
29 |
| - itertools.product(["pdb", "cif", "bcif", "fasta"], [False, True]), |
| 27 | + "format, extended_id", |
| 28 | + [ |
| 29 | + pytest.param("pdb", False), |
| 30 | + pytest.param("cif", False), |
| 31 | + pytest.param("cif", True), |
| 32 | + pytest.param("bcif", False), |
| 33 | + # https://models.rcsb.org/ does not support extended PDB IDs yet |
| 34 | + pytest.param("bcif", True, marks=pytest.mark.xfail), |
| 35 | + pytest.param("fasta", False), |
| 36 | + ], |
30 | 37 | )
|
31 |
| -def test_fetch(format, as_file_like): |
| 38 | +def test_fetch(format, as_file_like, extended_id): |
| 39 | + PDB_ID = "1aki" |
| 40 | + pdb_id = PDB_ID if not extended_id else "pdb_0000" + PDB_ID |
32 | 41 | path = None if as_file_like else tempfile.gettempdir()
|
33 |
| - file_path_or_obj = rcsb.fetch("1l2y", format, path, overwrite=True) |
| 42 | + file_path_or_obj = rcsb.fetch(pdb_id, format, path, overwrite=True) |
34 | 43 | if format == "pdb":
|
35 | 44 | file = pdb.PDBFile.read(file_path_or_obj)
|
| 45 | + print(file.lines) |
36 | 46 | pdb.get_structure(file)
|
37 | 47 | elif format == "cif":
|
38 | 48 | file = pdbx.CIFFile.read(file_path_or_obj)
|
|
0 commit comments