-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split test cases for dynamically-typed languages (#39)
PR #36 added a couple of test cases for handling incorrectly-typed attributes. While these tests are important for dynamically-typed languages, they should be skipped in statically-typed languages because a type system ensures this input is impossible. Having these test cases in the same file is problematic as it fails test file parsing and requires a lot of special handling just to skip offending test cases. This commit copies such test cases into ".dynamic-typing.json" files (so they are easy to ignore) and removes/fixes offending data in original files (so statically-typed languages see same test cases).
- Loading branch information
Showing
4 changed files
with
295 additions
and
18 deletions.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
ufc/bandit-tests/test-case-banner-bandit-uk-only.dynamic-typing.json
This file contains 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,112 @@ | ||
{ | ||
"flag": "banner_bandit_flag_uk_only", | ||
"defaultValue": "default", | ||
"subjects": [ | ||
{ | ||
"subjectKey": "erica", | ||
"subjectAttributes": { | ||
"numericAttributes": {"age": 28, "account_age": 30}, | ||
"categoricalAttributes": {"country": "USA", "gender_identity": "female"} | ||
}, | ||
"actions": [ | ||
{ | ||
"actionKey": "nike", | ||
"numericAttributes": {"brand_affinity": 1.2}, | ||
"categoricalAttributes": {"loyalty_tier": "platinum"} | ||
}, | ||
{ | ||
"actionKey": "adidas", | ||
"numericAttributes": {"brand_affinity": 1.0}, | ||
"categoricalAttributes": {"loyalty_tier": null} | ||
}, | ||
{ | ||
"actionKey": "reebok", | ||
"numericAttributes": {}, | ||
"categoricalAttributes": {} | ||
}, | ||
{ | ||
"actionKey": "puma", | ||
"numericAttributes": { | ||
"brand_affinity": 1.0, | ||
"discount": 0.1 | ||
}, | ||
"categoricalAttributes": { | ||
"color": "red" | ||
} | ||
} | ||
], | ||
"assignment": {"variation": "control", "action": null} | ||
}, | ||
|
||
{ | ||
"subjectKey": "frenkie", | ||
"subjectAttributes": { | ||
"numericAttributes": {"age": 31, "account_age": 4}, | ||
"categoricalAttributes": {"country": "Netherlands", "gender_identity": "male"} | ||
}, | ||
"actions": [ | ||
{ | ||
"actionKey": "nike", | ||
"numericAttributes": {"brand_affinity": 0.5}, | ||
"categoricalAttributes": {"loyalty_tier": "gold"} | ||
}, | ||
{ | ||
"actionKey": "adidas", | ||
"numericAttributes": {"brand_affinity": 0.0}, | ||
"categoricalAttributes": {"loyalty_tier": null} | ||
}, | ||
{ | ||
"actionKey": "reebok", | ||
"numericAttributes": {}, | ||
"categoricalAttributes": {} | ||
}, | ||
{ | ||
"actionKey": "puma", | ||
"numericAttributes": { | ||
"brand_affinity": 1.0, | ||
"discount": 0.1 | ||
}, | ||
"categoricalAttributes": { | ||
"color": "red" | ||
} | ||
} | ||
], | ||
"assignment": {"variation": "control", "action": null} | ||
}, | ||
{ | ||
"subjectKey": "gerard", | ||
"subjectAttributes": { | ||
"numericAttributes": {"age": null}, | ||
"categoricalAttributes": {"country": null, "gender_identity": null} | ||
}, | ||
"actions": [ | ||
{ | ||
"actionKey": "nike", | ||
"numericAttributes": {"brand_affinity": null}, | ||
"categoricalAttributes": {"loyalty_tier": null} | ||
}, | ||
{ | ||
"actionKey": "adidas", | ||
"numericAttributes": {"brand_affinity": 0.1}, | ||
"categoricalAttributes": {"loyalty_tier": null} | ||
}, | ||
{ | ||
"actionKey": "reebok", | ||
"numericAttributes": {}, | ||
"categoricalAttributes": {} | ||
}, | ||
{ | ||
"actionKey": "puma", | ||
"numericAttributes": { | ||
"brand_affinity": 1.0, | ||
"discount": 0.1 | ||
}, | ||
"categoricalAttributes": { | ||
"color": "red" | ||
} | ||
} | ||
], | ||
"assignment": {"variation": "control", "action": null} | ||
} | ||
] | ||
} |
This file contains 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
165 changes: 165 additions & 0 deletions
165
ufc/bandit-tests/test-case-banner-bandit.dynamic-typing.json
This file contains 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,165 @@ | ||
{ | ||
"flag": "banner_bandit_flag", | ||
"defaultValue": "default", | ||
"subjects": [ | ||
{ | ||
"subjectKey": "henry", | ||
"subjectAttributes": { | ||
"numericAttributes": { "age": 25, "mistake": "oops" }, | ||
"categoricalAttributes": {"country": "USA", "gender_identity": "female", "area_code": 303} | ||
}, | ||
"actions": [ | ||
{ | ||
"actionKey": "nike", | ||
"numericAttributes": {"brand_affinity": -5}, | ||
"categoricalAttributes": {"loyalty_tier": "silver"} | ||
}, | ||
{ | ||
"actionKey": "adidas", | ||
"numericAttributes": {"brand_affinity": 1.0}, | ||
"categoricalAttributes": {"loyalty_tier": "bronze"} | ||
}, | ||
{ | ||
"actionKey": "reebok", | ||
"numericAttributes": {"brand_affinity": 20}, | ||
"categoricalAttributes": {"loyalty_tier": "gold"} | ||
} | ||
], | ||
"assignment": {"variation": "banner_bandit", "action": "adidas"} | ||
}, | ||
|
||
{ | ||
"subjectKey": "imogene", | ||
"subjectAttributes": { | ||
"numericAttributes": { "age": 25}, | ||
"categoricalAttributes": {"country": "USA", "gender_identity": "female"} | ||
}, | ||
"actions": [ | ||
{ | ||
"actionKey": "nike", | ||
"numericAttributes": {"brand_affinity": -1.7, "mistake": true}, | ||
"categoricalAttributes": {"loyalty_tier": "silver", "zip": 81427} | ||
}, | ||
{ | ||
"actionKey": "adidas", | ||
"numericAttributes": {"brand_affinity": 1.0}, | ||
"categoricalAttributes": {"loyalty_tier": "bronze"} | ||
}, | ||
{ | ||
"actionKey": "reebok", | ||
"numericAttributes": {"brand_affinity": 15}, | ||
"categoricalAttributes": {"loyalty_tier": "gold"} | ||
} | ||
], | ||
"assignment": {"variation": "banner_bandit", "action": "nike"} | ||
}, | ||
|
||
{ | ||
"subjectKey": "erica", | ||
"subjectAttributes": { | ||
"numericAttributes": {"age": 28, "account_age": 30}, | ||
"categoricalAttributes": {"country": "USA", "gender_identity": "female"} | ||
}, | ||
"actions": [ | ||
{ | ||
"actionKey": "nike", | ||
"numericAttributes": {"brand_affinity": 1.2}, | ||
"categoricalAttributes": {"loyalty_tier": "platinum"} | ||
}, | ||
{ | ||
"actionKey": "adidas", | ||
"numericAttributes": {"brand_affinity": 1.0}, | ||
"categoricalAttributes": {"loyalty_tier": null} | ||
}, | ||
{ | ||
"actionKey": "reebok", | ||
"numericAttributes": {}, | ||
"categoricalAttributes": {} | ||
}, | ||
{ | ||
"actionKey": "puma", | ||
"numericAttributes": { | ||
"brand_affinity": 1.0, | ||
"discount": 0.1 | ||
}, | ||
"categoricalAttributes": { | ||
"color": "red" | ||
} | ||
} | ||
], | ||
"assignment": {"variation": "default", "action": null} | ||
}, | ||
|
||
{ | ||
"subjectKey": "frenkie", | ||
"subjectAttributes": { | ||
"numericAttributes": {"age": 31, "account_age": 4}, | ||
"categoricalAttributes": {"country": "Netherlands", "gender_identity": "male"} | ||
}, | ||
"actions": [ | ||
{ | ||
"actionKey": "nike", | ||
"numericAttributes": {"brand_affinity": 0.5}, | ||
"categoricalAttributes": {"loyalty_tier": "gold"} | ||
}, | ||
{ | ||
"actionKey": "adidas", | ||
"numericAttributes": {"brand_affinity": 0.0}, | ||
"categoricalAttributes": {"loyalty_tier": null} | ||
}, | ||
{ | ||
"actionKey": "reebok", | ||
"numericAttributes": {}, | ||
"categoricalAttributes": {} | ||
}, | ||
{ | ||
"actionKey": "puma", | ||
"numericAttributes": { | ||
"brand_affinity": 1.0, | ||
"discount": 0.1 | ||
}, | ||
"categoricalAttributes": { | ||
"color": "red" | ||
} | ||
} | ||
], | ||
"assignment": {"variation": "banner_bandit", "action": "puma"} | ||
}, | ||
|
||
{ | ||
"subjectKey": "gerard", | ||
"subjectAttributes": { | ||
"numericAttributes": {"age": null}, | ||
"categoricalAttributes": {"country": null, "gender_identity": null} | ||
}, | ||
"actions": [ | ||
{ | ||
"actionKey": "nike", | ||
"numericAttributes": {"brand_affinity": null}, | ||
"categoricalAttributes": {"loyalty_tier": null} | ||
}, | ||
{ | ||
"actionKey": "adidas", | ||
"numericAttributes": {"brand_affinity": 0.1}, | ||
"categoricalAttributes": {"loyalty_tier": null} | ||
}, | ||
{ | ||
"actionKey": "reebok", | ||
"numericAttributes": {}, | ||
"categoricalAttributes": {} | ||
}, | ||
{ | ||
"actionKey": "puma", | ||
"numericAttributes": { | ||
"brand_affinity": 1.0, | ||
"discount": 0.1 | ||
}, | ||
"categoricalAttributes": { | ||
"color": "red" | ||
} | ||
} | ||
], | ||
"assignment": {"variation": "banner_bandit", "action": "nike"} | ||
} | ||
] | ||
} |
This file contains 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