@@ -340,8 +340,8 @@ def test_set_measurement_deprecated(sentry_init):
340340
341341def test_set_meaurement_compared_to_set_data (sentry_init , capture_events ):
342342 """
343- This is just a test to see if we can use set_data() instead of set_measurement() with
344- the same result in the backend .
343+ This is just a test to see the difference
344+ between measurements and data in the resulting event payload .
345345 """
346346 sentry_init (traces_sample_rate = 1.0 )
347347
@@ -350,15 +350,19 @@ def test_set_meaurement_compared_to_set_data(sentry_init, capture_events):
350350 with start_transaction (name = "measuring stuff" ) as transaction :
351351 transaction .set_measurement ("metric.foo" , 123 )
352352 transaction .set_data ("metric.bar" , 456 )
353+
353354 with start_span (op = "measuring span" ) as span :
354355 span .set_measurement ("metric.baz" , 420.69 , unit = "custom" )
355356 span .set_data ("metric.qux" , 789 )
356357
357358 (event ,) = events
358- from pprint import pprint
359-
360- pprint (event )
361- raise AssertionError ("This test is not finished yet." )
359+ assert event ["measurements" ]["metric.foo" ] == {"value" : 123 , "unit" : "" }
360+ assert event ["contexts" ]["trace" ]["data" ]["metric.bar" ] == 456
361+ assert event ["spans" ][0 ]["measurements" ]["metric.baz" ] == {
362+ "value" : 420.69 ,
363+ "unit" : "custom" ,
364+ }
365+ assert event ["spans" ][0 ]["data" ]["metric.qux" ] == 789
362366
363367
364368@pytest .mark .parametrize (
0 commit comments