Skip to content

Commit

Permalink
fix: set group should set user property (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercy811 committed Sep 1, 2023
1 parent cf4a4c3 commit 964a1b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/amplitude/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ def set_group(self, group_type: str, group_name: Union[str, List[str]], event_op
event_options (amplitude.event.EventOptions): Provide additional information for event
like user_id.
"""
event = IdentifyEvent(groups={group_type: group_name})
identify = Identify().set(group_type, group_name)
event = IdentifyEvent(groups={group_type: group_name}, user_properties=identify.user_properties)
event.load_event_options(event_options)
self.track(event)

Expand Down
1 change: 1 addition & 0 deletions src/test/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ def callback_func(event, code, message=None):
self.assertEqual("test_user_id", event["user_id"])
self.assertEqual("test_device_id", event["device_id"])
self.assertEqual({"type": ["test_group", "test_group_2"]}, event.groups)
self.assertEqual({"$set": {"type": ["test_group", "test_group_2"]}}, event.user_properties)

self.client.configuration.callback = callback_func
for use_batch in (True, False):
Expand Down

0 comments on commit 964a1b6

Please sign in to comment.