Skip to content

Commit 15e8fe4

Browse files
committed
Rename GoogleCloudHealthcare to GoogleCloudHealthcareURL.
1 parent 29b7547 commit 15e8fe4

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

src/dicomweb_client/uri.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ class URISuffix(enum.Enum):
2525
# For DICOM Standard spec validation of UID components in `URI`.
2626
_MAX_UID_LENGTH = 64
2727
_REGEX_UID = re.compile(r'[0-9]+([.][0-9]+)*')
28-
# Used for Project ID and Location validation in `GoogleCloudHealthcare`.
28+
# Used for Project ID and Location validation in `GoogleCloudHealthcareURL`.
2929
_REGEX_ID_1 = r'[\w-]+'
3030
_ATTR_VALIDATOR_ID_1 = attr.validators.matches_re(_REGEX_ID_1)
3131
# Used for Dataset ID and DICOM Store ID validation in
32-
# `GoogleCloudHealthcare`.
32+
# `GoogleCloudHealthcareURL`.
3333
_REGEX_ID_2 = r'[\w.-]+'
3434
_ATTR_VALIDATOR_ID_2 = attr.validators.matches_re(_REGEX_ID_2)
3535
# The URL for the Google Cloud Healthcare API endpoint.
@@ -449,7 +449,7 @@ def from_string(cls,
449449

450450

451451
@attr.s(frozen=True)
452-
class GoogleCloudHealthcare:
452+
class GoogleCloudHealthcareURL:
453453
"""Base URL container for DICOM Stores under the `Google Cloud Healthcare API`_.
454454
455455
This class facilitates the parsing and creation of :py:attr:`URI.base_url`
@@ -495,7 +495,7 @@ def __str__(self) -> str:
495495
f'dicomStores/{self.dicom_store_id}/dicomWeb')
496496

497497
@classmethod
498-
def from_string(cls, base_url: str) -> 'GoogleCloudHealthcare':
498+
def from_string(cls, base_url: str) -> 'GoogleCloudHealthcareURL':
499499
"""Creates an instance from ``base_url``.
500500
501501
Parameters

tests/test_uri.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from dicomweb_client.uri import (
2-
GoogleCloudHealthcare,
2+
GoogleCloudHealthcareURL,
33
URI,
44
URISuffix,
55
URIType)
@@ -451,9 +451,9 @@ def test_update_error(uri_args, update_args, error_msg):
451451

452452

453453
def test_chc_dicom_store_str():
454-
"""Locks down `GoogleCloudHealthcare.__str__()`."""
454+
"""Locks down `GoogleCloudHealthcareURL.__str__()`."""
455455
assert str(
456-
GoogleCloudHealthcare(
456+
GoogleCloudHealthcareURL(
457457
_PROJECT_ID,
458458
_LOCATION,
459459
_DATASET_ID,
@@ -462,27 +462,29 @@ def test_chc_dicom_store_str():
462462

463463
@pytest.mark.parametrize('name', ['hmmm.1', '#95', '43/'])
464464
def test_chc_invalid_project_or_location(name):
465-
"""Tests `GoogleCloudHealthcare` for bad `project_id`, `location`."""
465+
"""Tests for bad `project_id`, `location`."""
466466
with pytest.raises(ValueError):
467-
GoogleCloudHealthcare(name, _LOCATION, _DATASET_ID, _DICOM_STORE_ID)
467+
GoogleCloudHealthcareURL(name, _LOCATION, _DATASET_ID, _DICOM_STORE_ID)
468468
with pytest.raises(ValueError):
469-
GoogleCloudHealthcare(_PROJECT_ID, name, _DATASET_ID, _DICOM_STORE_ID)
469+
GoogleCloudHealthcareURL(
470+
_PROJECT_ID, name, _DATASET_ID, _DICOM_STORE_ID)
470471

471472

472473
@pytest.mark.parametrize('name', ['hmmm.!', '#95', '43/'])
473474
def test_chc_invalid_dataset_or_store(name):
474-
"""Tests `GoogleCloudHealthcare` for bad `dataset_id`, `dicom_store_id`."""
475+
"""Tests for bad `dataset_id`, `dicom_store_id`."""
475476
with pytest.raises(ValueError):
476-
GoogleCloudHealthcare(name, _LOCATION, _DATASET_ID, _DICOM_STORE_ID)
477+
GoogleCloudHealthcareURL(name, _LOCATION, _DATASET_ID, _DICOM_STORE_ID)
477478
with pytest.raises(ValueError):
478-
GoogleCloudHealthcare(_PROJECT_ID, name, _DATASET_ID, _DICOM_STORE_ID)
479+
GoogleCloudHealthcareURL(
480+
_PROJECT_ID, name, _DATASET_ID, _DICOM_STORE_ID)
479481

480482

481483
@pytest.mark.parametrize('url', [f'{_CHC_API_URL}beta', 'https://some.url'])
482484
def test_chc_from_string_invalid_api(url):
483-
"""Tests for bad API URL error`GoogleCloudHealthcare.from_string()`."""
485+
"""Tests for bad API URL error`GoogleCloudHealthcareURL.from_string()`."""
484486
with pytest.raises(ValueError, match='v1 URL'):
485-
GoogleCloudHealthcare.from_string(url)
487+
GoogleCloudHealthcareURL.from_string(url)
486488

487489

488490
@pytest.mark.parametrize('url', [
@@ -498,14 +500,14 @@ def test_chc_from_string_invalid_api(url):
498500
f'{_CHC_API_URL}/projects/p/locations/l//datasets/d/dicomStores/ds/dicomWeb'
499501
])
500502
def test_chc_from_string_invalid_store_name(url):
501-
"""Tests for bad Store name `GoogleCloudHealthcare.from_string()`."""
503+
"""Tests for bad Store name `GoogleCloudHealthcareURL.from_string()`."""
502504
with pytest.raises(ValueError, match='v1 DICOM'):
503-
GoogleCloudHealthcare.from_string(url)
505+
GoogleCloudHealthcareURL.from_string(url)
504506

505507

506508
def test_chc_from_string_success():
507-
"""Locks down `GoogleCloudHealthcare.from_string()`."""
508-
store = GoogleCloudHealthcare.from_string(_CHC_BASE_URL)
509+
"""Locks down `GoogleCloudHealthcareURL.from_string()`."""
510+
store = GoogleCloudHealthcareURL.from_string(_CHC_BASE_URL)
509511
assert store.project_id == _PROJECT_ID
510512
assert store.location == _LOCATION
511513
assert store.dataset_id == _DATASET_ID

0 commit comments

Comments
 (0)