@@ -338,7 +338,7 @@ def test_create_update_current_trace():
338338 user_id = "test" ,
339339 metadata = {"key" : "value" },
340340 public = True ,
341- input = "test_input"
341+ input = "test_input" ,
342342 )
343343 # Get trace ID for later reference
344344 trace_id = span .trace_id
@@ -347,7 +347,9 @@ def test_create_update_current_trace():
347347 sleep (1 )
348348
349349 # Update trace properties using update_current_trace
350- langfuse .update_current_trace (metadata = {"key2" : "value2" }, public = False , version = "1.0" )
350+ langfuse .update_current_trace (
351+ metadata = {"key2" : "value2" }, public = False , version = "1.0"
352+ )
351353
352354 # Ensure data is sent to the API
353355 langfuse .flush ()
@@ -1957,9 +1959,9 @@ def test_start_as_current_observation_types():
19571959 expected_types = {obs_type .upper () for obs_type in observation_types } | {
19581960 "SPAN"
19591961 } # includes parent span
1960- assert expected_types .issubset (found_types ), (
1961- f"Missing types: { expected_types - found_types } "
1962- )
1962+ assert expected_types .issubset (
1963+ found_types
1964+ ), f"Missing types: { expected_types - found_types } "
19631965
19641966 # Verify each specific observation exists
19651967 for obs_type in observation_types :
@@ -2003,25 +2005,25 @@ def test_that_generation_like_properties_are_actually_created():
20032005 ) as obs :
20042006 # Verify the properties are accessible on the observation object
20052007 if hasattr (obs , "model" ):
2006- assert obs . model == test_model , (
2007- f" { obs_type } should have model property"
2008- )
2008+ assert (
2009+ obs . model == test_model
2010+ ), f" { obs_type } should have model property"
20092011 if hasattr (obs , "completion_start_time" ):
2010- assert obs . completion_start_time == test_completion_start_time , (
2011- f" { obs_type } should have completion_start_time property"
2012- )
2012+ assert (
2013+ obs . completion_start_time == test_completion_start_time
2014+ ), f" { obs_type } should have completion_start_time property"
20132015 if hasattr (obs , "model_parameters" ):
2014- assert obs . model_parameters == test_model_parameters , (
2015- f" { obs_type } should have model_parameters property"
2016- )
2016+ assert (
2017+ obs . model_parameters == test_model_parameters
2018+ ), f" { obs_type } should have model_parameters property"
20172019 if hasattr (obs , "usage_details" ):
2018- assert obs . usage_details == test_usage_details , (
2019- f" { obs_type } should have usage_details property"
2020- )
2020+ assert (
2021+ obs . usage_details == test_usage_details
2022+ ), f" { obs_type } should have usage_details property"
20212023 if hasattr (obs , "cost_details" ):
2022- assert obs . cost_details == test_cost_details , (
2023- f" { obs_type } should have cost_details property"
2024- )
2024+ assert (
2025+ obs . cost_details == test_cost_details
2026+ ), f" { obs_type } should have cost_details property"
20252027
20262028 langfuse .flush ()
20272029
@@ -2035,28 +2037,28 @@ def test_that_generation_like_properties_are_actually_created():
20352037 for obs in trace .observations
20362038 if obs .name == f"test-{ obs_type } " and obs .type == obs_type .upper ()
20372039 ]
2038- assert len ( observations ) == 1 , (
2039- f"Expected one { obs_type . upper () } observation, but found { len (observations )} "
2040- )
2040+ assert (
2041+ len (observations ) == 1
2042+ ), f"Expected one { obs_type . upper () } observation, but found { len ( observations ) } "
20412043
20422044 obs = observations [0 ]
20432045
20442046 assert obs .model == test_model , f"{ obs_type } should have model property"
2045- assert obs . model_parameters == test_model_parameters , (
2046- f" { obs_type } should have model_parameters property"
2047- )
2047+ assert (
2048+ obs . model_parameters == test_model_parameters
2049+ ), f" { obs_type } should have model_parameters property"
20482050
20492051 # usage_details
20502052 assert hasattr (obs , "usage_details" ), f"{ obs_type } should have usage_details"
2051- assert obs .usage_details == dict (test_usage_details , total = 30 ), (
2052- f" { obs_type } should persist usage_details"
2053- ) # API adds total
2053+ assert obs .usage_details == dict (
2054+ test_usage_details , total = 30
2055+ ), f" { obs_type } should persist usage_details" # API adds total
20542056
2055- assert obs . cost_details == test_cost_details , (
2056- f" { obs_type } should persist cost_details"
2057- )
2057+ assert (
2058+ obs . cost_details == test_cost_details
2059+ ), f" { obs_type } should persist cost_details"
20582060
20592061 # completion_start_time, because of time skew not asserting time
2060- assert obs . completion_start_time is not None , (
2061- f" { obs_type } should persist completion_start_time property"
2062- )
2062+ assert (
2063+ obs . completion_start_time is not None
2064+ ), f" { obs_type } should persist completion_start_time property"
0 commit comments