Skip to content

Commit dd353c8

Browse files
committed
revert: drop _from_vrs fix from location bounds branch
The fix landed on main separately (#656, follow-up #668), so remove it and its tests to keep this branch focused on location bounds validation.
1 parent 31ba35e commit dd353c8

2 files changed

Lines changed: 2 additions & 33 deletions

File tree

‎src/ga4gh/vrs/extras/translator.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ def _from_vrs(self, var: dict, **kwargs) -> models._VariationBase | None: # noq
167167
if "type" not in var:
168168
return None
169169
try:
170-
model = getattr(models, models.VrsType(var["type"]).value)
171-
except ValueError:
170+
model = models[var["type"]]
171+
except KeyError:
172172
return None
173173
return model(**var)
174174

‎tests/extras/test_allele_translator.py‎

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -337,37 +337,6 @@ def test_from_invalid(tlr):
337337
tlr.translate_from("BRAF amplication", assembly_name="GRCh37")
338338

339339

340-
from_vrs_cases = [
341-
{"id": "allele", "var": snv_output},
342-
# VRS input is trusted as-is: not validated against the sequence or normalized
343-
{
344-
"id": "allele-out-of-bounds-unvalidated",
345-
"var": {
346-
**snv_output,
347-
"location": {**snv_output["location"], "start": 99999999, "end": 5},
348-
},
349-
},
350-
]
351-
352-
353-
@pytest.mark.parametrize("case", from_vrs_cases, ids=lambda c: c["id"])
354-
def test_from_vrs(tlr: AlleleTranslator, case: dict) -> None:
355-
vo = tlr.translate_from(case["var"], fmt="vrs")
356-
assert vo.model_dump(exclude_none=True) == case["var"]
357-
358-
359-
from_vrs_invalid_cases = [
360-
{"id": "unknown-type", "var": {"type": "Bogus"}},
361-
{"id": "missing-type", "var": {"location": snv_output["location"]}},
362-
]
363-
364-
365-
@pytest.mark.parametrize("case", from_vrs_invalid_cases, ids=lambda c: c["id"])
366-
def test_from_vrs_invalid(tlr: AlleleTranslator, case: dict) -> None:
367-
with pytest.raises(ValueError, match="^Unable to parse data as vrs variation$"):
368-
tlr.translate_from(case["var"], fmt="vrs")
369-
370-
371340
@pytest.mark.vcr
372341
def test_from_beacon(tlr):
373342
do_normalize = False

0 commit comments

Comments
 (0)