Skip to content

Commit f031e28

Browse files
committed
tests: refactor tests for ExternalIdentifier to account for automatically computed URLs
1 parent 96793e5 commit f031e28

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

tests/models/test_simulation.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,21 +107,3 @@ def test_invalid_simulation_value_type():
107107
SimulationMetadata(
108108
simulation_timesteps_in_fs=["invalid-value"], # because not a float
109109
)
110-
111-
112-
# --------------------------------------
113-
# Test compute URL in ExternalIdentifier
114-
# --------------------------------------
115-
def test_compute_url_in_external_identifier():
116-
"""Test that the compute_url method generates the correct URL."""
117-
identifier = ExternalIdentifier(
118-
database_name=ExternalDatabaseName.PDB,
119-
identifier="1ABC",
120-
)
121-
assert identifier.url == "https://www.rcsb.org/structure/1ABC"
122-
123-
identifier = ExternalIdentifier(
124-
database_name=ExternalDatabaseName.UNIPROT,
125-
identifier="P12345",
126-
)
127-
assert identifier.url == "https://www.uniprot.org/uniprotkb/P12345"

tests/models/test_simulation_molecule.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,12 @@ def test_invalid_number_of_molecules():
5454
"1K79",
5555
"https://www.rcsb.org/structure/1K79",
5656
),
57-
(ExternalDatabaseName.PDB, 1234, "1234", None),
5857
(
5958
ExternalDatabaseName.UNIPROT,
6059
"P06213",
6160
"P06213",
6261
"https://www.uniprot.org/uniprotkb/P06213/entry",
6362
),
64-
(ExternalDatabaseName.UNIPROT, 123456, "123456", None),
6563
],
6664
)
6765
def test_external_identifier_creation(
@@ -91,3 +89,18 @@ def test_invalid_database_name_in_external_identifiers():
9189
database_name=ExternalDatabaseName.DUMMY, # type: ignore
9290
identifier="1ABC",
9391
)
92+
93+
94+
def test_compute_url_in_external_identifier():
95+
"""Test that the compute_url method generates the correct URL."""
96+
identifier = ExternalIdentifier(
97+
database_name=ExternalDatabaseName.PDB,
98+
identifier="1ABC",
99+
)
100+
assert identifier.url == "https://www.rcsb.org/structure/1ABC"
101+
102+
identifier = ExternalIdentifier(
103+
database_name=ExternalDatabaseName.UNIPROT,
104+
identifier="P12345",
105+
)
106+
assert identifier.url == "https://www.uniprot.org/uniprotkb/P12345"

0 commit comments

Comments
 (0)