-
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.
fix: flatten "base" in AssignmentEvent (#46)
* fix: flatten "base" in event * chore: bump versions
- Loading branch information
Showing
5 changed files
with
28 additions
and
5 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "eppo_py" | ||
version = "4.0.2" | ||
version = "4.0.3" | ||
edition = "2021" | ||
publish = false | ||
|
||
|
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 |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
from eppo_client.assignment_logger import AssignmentLogger | ||
|
||
from .util import init | ||
|
||
|
||
def test_can_inherit_assignment_logger(): | ||
class MyAssignmentLogger(AssignmentLogger): | ||
|
@@ -27,3 +29,23 @@ def test_has_log_assignment(): | |
|
||
def test_has_log_bandit_action(): | ||
AssignmentLogger().log_bandit_action({}) | ||
|
||
|
||
def test_event_format(): | ||
event = None | ||
|
||
class MyAssignmentLogger(AssignmentLogger): | ||
def log_assignment(self, assignment_event: Dict): | ||
nonlocal event | ||
event = assignment_event | ||
|
||
client = init("ufc", assignment_logger=MyAssignmentLogger()) | ||
result = client.get_string_assignment( | ||
"regex-flag", "alice", {"email": "[email protected]"}, "default" | ||
) | ||
assert result == "partial-example" | ||
|
||
assert event["allocation"] == "partial-example" | ||
assert event["featureFlag"] == "regex-flag" | ||
assert event["experiment"] == "regex-flag-partial-example" | ||
assert event["metaData"]["sdkName"] == "python" |
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
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