MCPcopy
hub / github.com/PostHog/posthog / _get_trend_people

Method _get_trend_people

posthog/queries/test/test_trends.py:84–97  ·  view source on GitHub ↗
(self, filter: Filter, entity: Entity)

Source from the content-addressed store, hash-verified

82 maxDiff = None
83
84 def _get_trend_people(self, filter: Filter, entity: Entity):
85 data = filter.to_dict()
86 # The test client doesn't serialize nested objects into JSON, so we need to do it ourselves
87 if data.get("events", None):
88 data["events"] = json.dumps(data["events"])
89 if data.get("properties", None):
90 data["properties"] = json.dumps(data["properties"])
91 with self.settings(DEBUG=True):
92 response = self.client.get(
93 f"/api/projects/{self.team.id}/persons/trends/",
94 data={**data, ENTITY_TYPE: entity.type, ENTITY_ID: entity.id},
95 content_type="application/json",
96 ).json()
97 return response["results"][0]["people"]
98
99 def _create_events(self, use_time=False) -> Tuple[Action, Person]:
100

Calls 3

jsonMethod · 0.80
getMethod · 0.65
to_dictMethod · 0.45

Tested by

no test coverage detected