Skip to content

Commit d32eeae

Browse files
committed
Add string_field presets: hashes, barcodes, dates
1 parent bdc0f7d commit d32eeae

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

docs/user-guide/test-data-generation.qmd

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,25 @@ The `preset=` parameter in `string_field()` supports many data types:
219219
**Identifiers:**
220220

221221
- `uuid4`: UUID version 4
222+
- `md5`: MD5 hash (32 hex characters)
223+
- `sha1`: SHA-1 hash (40 hex characters)
224+
- `sha256`: SHA-256 hash (64 hex characters)
222225
- `ssn`: Social Security Number (country-specific format)
223226
- `license_plate`: vehicle license plate (location-aware for CA, US, DE, AU, GB)
224227

228+
**Barcodes:**
229+
230+
- `ean8`: EAN-8 barcode with valid check digit
231+
- `ean13`: EAN-13 barcode with valid check digit
232+
225233
**Date/Time:**
226234

227235
- `date_this_year`: a date within the current year
228236
- `date_this_decade`: a date within the current decade
237+
- `date_between`: a random date between 2000 and 2025
238+
- `date_range`: two dates joined with an en-dash (e.g., `"2012-05-12 – 2015-11-22"`)
239+
- `future_date`: a date up to 1 year in the future
240+
- `past_date`: a date up to 10 years in the past
229241
- `time`: a time value
230242

231243
**Text:**

pointblank/field.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,9 +863,17 @@ def string_field(
863863
864864
**Financial:** `"credit_card_number"`, `"iban"`, `"currency_code"`
865865
866-
**Identifiers:** `"uuid4"`, `"ssn"` (social security number), `"license_plate"`
866+
**Identifiers:** `"uuid4"`, `"md5"` (MD5 hash, 32 hex chars), `"sha1"` (SHA-1 hash,
867+
40 hex chars), `"sha256"` (SHA-256 hash, 64 hex chars), `"ssn"` (social security number),
868+
`"license_plate"`
867869
868-
**Date/Time (as strings):** `"date_this_year"`, `"date_this_decade"`, `"time"`
870+
**Barcodes:** `"ean8"` (EAN-8 barcode with valid check digit), `"ean13"` (EAN-13 barcode
871+
with valid check digit)
872+
873+
**Date/Time (as strings):** `"date_this_year"`, `"date_this_decade"`, `"date_between"`
874+
(random date between 2000–2025), `"date_range"` (two dates joined with an en-dash, e.g.,
875+
`"2012-05-12 – 2015-11-22"`), `"future_date"` (up to 1 year ahead), `"past_date"`
876+
(up to 10 years back), `"time"`
869877
870878
**Miscellaneous:** `"color_name"`, `"file_name"`, `"file_extension"`, `"mime_type"`
871879

0 commit comments

Comments
 (0)