Skip to content

Commit 91bf1da

Browse files
committed
Added few more testcases
1 parent 62bfa40 commit 91bf1da

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

python-schema-match/app-test.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,32 @@
8989
# 10. PASS: Exact match
9090
'/edge/nested_null': {
9191
"data": {"value": None}
92+
},
93+
94+
# 11. FAIL: Complex User (Type mismatch + Missing nested key)
95+
'/complex/user': {
96+
"id": "500", # FAIL: Expected int, got string
97+
"name": "Jane Doe",
98+
"contact": {
99+
"email": "jane@example.com"
100+
# FAIL: Missing "phone" key
101+
},
102+
"tags": ["vip", "early-adopter"],
103+
"metadata": {
104+
"created_at": "2023-01-01T00:00:00Z",
105+
"login_count": 42
106+
}
107+
},
108+
109+
# 12. FAIL: Complex Product (Array item mismatch)
110+
'/complex/product': {
111+
"sku": "XYZ-999",
112+
"specs": [
113+
{"key": "weight", "value": "1.5kg", "unit": "kg"}, # FAIL: value expected float, got string
114+
{"key": "warranty", "value": 2, "unit": "years"}
115+
],
116+
"in_stock": True,
117+
"dimensions": [10, "20", 5.5] # FAIL: 2nd element expected int/float, got string
92118
}
93119
}
94120

python-schema-match/app.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,28 @@
6565
# Added 10th endpoint for clean 7/3 split
6666
'/edge/nested_null': {
6767
"data": {"value": None}
68+
},
69+
'/complex/user': {
70+
"id": 500,
71+
"name": "Jane Doe",
72+
"contact": {
73+
"email": "jane@example.com",
74+
"phone": {"home": "555-0123", "mobile": "555-0987"}
75+
},
76+
"tags": ["vip", "early-adopter"],
77+
"metadata": {
78+
"created_at": "2023-01-01T00:00:00Z",
79+
"login_count": 42
80+
}
81+
},
82+
'/complex/product': {
83+
"sku": "XYZ-999",
84+
"specs": [
85+
{"key": "weight", "value": 1.5, "unit": "kg"},
86+
{"key": "warranty", "value": 2, "unit": "years"}
87+
],
88+
"in_stock": True,
89+
"dimensions": [10, 20, 5.5]
6890
}
6991
}
7092

python-schema-match/check-endpoints.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
'/edge/empty_response',
1414
'/edge/null_root',
1515
'/edge/special_chars',
16-
'/edge/nested_null'
16+
'/edge/nested_null',
17+
'/complex/user',
18+
'/complex/product'
1719
]
1820

1921
def check_endpoints():

0 commit comments

Comments
 (0)