File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -117,23 +117,17 @@ def month_string_to_number(string: str) -> int:
117117 out = months [month_short ]
118118 return out
119119 except Exception :
120- raise ValueError ("Not a month" )
120+ raise ValueError (
121+ f"'{ string } ' is not a valid month name. Accepted values are: { ', ' .join (months .keys ())} "
122+ )
121123
122124 @staticmethod
123125 def generate_unique_weekday_date (start_year : int = 2025 ) -> str :
124126 """
125- Generates a future weekday date from the specified year onward.
127+ Returns a random future weekday (Mon–Fri) date from the given year onward.
126128
127- This function returns a dynamically generated date string in the format 'dd/mm/yyyy'
128- that always falls on a weekday (Monday–Friday) and is suitable for use in automated tests
129- where the date must differ on each run to avoid duplication issues.
130-
131- A small pseudorandom offset is added to ensure uniqueness between runs.
132-
133- Note:
134- This function uses Python's built-in `random` module to add variability.
135- Since this is for test-only purposes and does not involve security-sensitive logic,
136- the use of a non-cryptographic PRNG is appropriate and intentional.
129+ The result is in 'dd/mm/yyyy' format and useful for automated tests needing
130+ unique, non-weekend dates. Uses non-cryptographic randomness for variability between runs.
137131
138132 Args:
139133 start_year (int): The minimum year from which the date may be generated. Defaults to 2025.
You can’t perform that action at this time.
0 commit comments