Skip to content

Commit 2620115

Browse files
committed
fix(tests): match orjson compact JSON format in createdAt regex
orjson produces compact JSON without spaces ("createdAt":"value") but the regex only matched YAML form (createdAt: value). Add the JSON variant to the regex so normalization works during recording. risk: low
1 parent bdc3fe4 commit 2620115

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/tests-support/src/tests_support/vcrpy_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@
6060
_normalization_configured: bool = False
6161

6262
# --- Timestamp normalization ---
63-
_CREATED_AT_RE = re.compile(r"(?<=createdAt: )\d{4}-\d{2}-\d{2} \d{2}:\d{2}")
63+
_CREATED_AT_RE = re.compile(
64+
r'(?<=createdAt":")\d{4}-\d{2}-\d{2} \d{2}:\d{2}' # JSON (orjson): "createdAt":"..."
65+
r"|"
66+
r"(?<=createdAt: )\d{4}-\d{2}-\d{2} \d{2}:\d{2}" # YAML: createdAt: ...
67+
)
6468
_CANONICAL_CREATED_AT = "2000-01-01 00:00"
6569

6670
# --- Dynamic hash normalization ---

0 commit comments

Comments
 (0)