forked from nhs-england-tools/playwright-python-blueprint
-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/bcss 21324 subject creation util #124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
adrianoaru-nhs
merged 6 commits into
main
from
feature/BCSS-21324-subject-creation-util
Aug 27, 2025
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
164b9e1
Adding subject creation util and relevant classes
adrianoaru-nhs 5954747
Fixing file format errors
adrianoaru-nhs 270d3de
Addressing PR comments
adrianoaru-nhs 7744f13
Merge branch 'main' of github.com:NHSDigital/bcss-playwright into fea…
adrianoaru-nhs 0431835
Fixing trailing white spaces
adrianoaru-nhs 681c760
Removingget and set methods from PISubject class
adrianoaru-nhs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| import logging | ||
|
|
||
|
|
||
| class Address: | ||
| """ | ||
| Represents a postal address with up to five address lines and a postcode. | ||
| Provides methods to set individual lines and to format the address as a string. | ||
| """ | ||
|
|
||
| def __init__(self) -> None: | ||
| self.address_line1: str = "" | ||
| self.address_line2: str = "" | ||
| self.address_line3: str = "" | ||
| self.address_line4: str = "" | ||
| self.address_line5: str = "" | ||
| self.post_code: str = "" | ||
|
|
||
| def set_address_line(self, line_number: int, address_line: str) -> None: | ||
| """ | ||
| Sets the specified address line (1-5) to the given value. | ||
| Args: | ||
| line_number (int): The address line number (1-5). | ||
| address_line (str): The value to set for the address line. | ||
| Raises: | ||
| ValueError: If line_number is not between 1 and 5. | ||
| """ | ||
| logging.info( | ||
| f"start: set_address_line(line_number={line_number}, address_line={address_line})" | ||
| ) | ||
| if line_number == 1: | ||
| self.address_line1 = address_line | ||
| elif line_number == 2: | ||
| self.address_line2 = address_line | ||
| elif line_number == 3: | ||
| self.address_line3 = address_line | ||
| elif line_number == 4: | ||
| self.address_line4 = address_line | ||
| elif line_number == 5: | ||
| self.address_line5 = address_line | ||
| else: | ||
| raise ValueError( | ||
| f"Invalid line number {line_number}, must be between 1 and 5" | ||
| ) | ||
| logging.info( | ||
| f"end: set_address_line(line_number={line_number}, address_line={address_line})" | ||
| ) | ||
|
|
||
| def __str__(self) -> str: | ||
| """ | ||
| Returns the formatted address as a single string. | ||
| """ | ||
| address_parts = [ | ||
| self.address_line1, | ||
| self.address_line2, | ||
| self.address_line3, | ||
| self.address_line4, | ||
| self.address_line5, | ||
| self.post_code, | ||
| ] | ||
| # Filter out empty or None values and join with ', ' | ||
| return ", ".join([part for part in address_parts if part]) | ||
|
|
||
| def get_address_line1(self) -> str: | ||
| """ | ||
| Returns the first address line. | ||
| """ | ||
| return self.address_line1 | ||
|
|
||
| def set_address_line1(self, address_line1: str) -> None: | ||
| """ | ||
| Sets the first address line. | ||
| """ | ||
| self.address_line1 = address_line1 | ||
|
|
||
| def get_address_line2(self) -> str: | ||
| """ | ||
| Returns the second address line. | ||
| """ | ||
| return self.address_line2 | ||
|
|
||
| def set_address_line2(self, address_line2: str) -> None: | ||
| """ | ||
| Sets the second address line. | ||
Andyg79 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| self.address_line2 = address_line2 | ||
|
|
||
| def get_address_line3(self) -> str: | ||
| """ | ||
| Returns the third address line. | ||
| """ | ||
| return self.address_line3 | ||
|
|
||
| def set_address_line3(self, address_line3: str) -> None: | ||
| """ | ||
| Sets the thrid address line. | ||
Andyg79 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| self.address_line3 = address_line3 | ||
|
|
||
| def get_address_line4(self) -> str: | ||
| """ | ||
| Returns the fourth address line. | ||
| """ | ||
| return self.address_line4 | ||
|
|
||
| def set_address_line4(self, address_line4: str) -> None: | ||
| """ | ||
| Sets the fourth address line. | ||
Andyg79 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| self.address_line4 = address_line4 | ||
|
|
||
| def get_address_line5(self) -> str: | ||
| """ | ||
| Returns the fifth address line. | ||
| """ | ||
| return self.address_line5 | ||
|
|
||
| def set_address_line5(self, address_line5: str) -> None: | ||
| """ | ||
| Sets the fifth address line. | ||
Andyg79 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
| self.address_line5 = address_line5 | ||
|
|
||
| def get_post_code(self) -> str: | ||
| """ | ||
| Returns the postcodde. | ||
| """ | ||
| return self.post_code | ||
|
|
||
| def set_post_code(self, post_code: str) -> None: | ||
| """ | ||
| Sets the postcode. | ||
| """ | ||
| self.post_code = post_code | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.