Skip to content

Commit 964a1b6

Browse files
authored
fix: set group should set user property (#51)
1 parent cf4a4c3 commit 964a1b6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/amplitude/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ def set_group(self, group_type: str, group_name: Union[str, List[str]], event_op
128128
event_options (amplitude.event.EventOptions): Provide additional information for event
129129
like user_id.
130130
"""
131-
event = IdentifyEvent(groups={group_type: group_name})
131+
identify = Identify().set(group_type, group_name)
132+
event = IdentifyEvent(groups={group_type: group_name}, user_properties=identify.user_properties)
132133
event.load_event_options(event_options)
133134
self.track(event)
134135

src/test/test_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ def callback_func(event, code, message=None):
194194
self.assertEqual("test_user_id", event["user_id"])
195195
self.assertEqual("test_device_id", event["device_id"])
196196
self.assertEqual({"type": ["test_group", "test_group_2"]}, event.groups)
197+
self.assertEqual({"$set": {"type": ["test_group", "test_group_2"]}}, event.user_properties)
197198

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

0 commit comments

Comments
 (0)