Skip to content

Commit a385577

Browse files
committed
push
1 parent 1e0eab2 commit a385577

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

tests/test_core_sdk.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,8 @@ def test_create_trace_sampling_zero():
17831783
def test_mask_function():
17841784
def mask_func(data):
17851785
if isinstance(data, dict):
1786+
if "should_raise" in data:
1787+
raise
17861788
return {k: "MASKED" for k in data}
17871789
elif isinstance(data, str):
17881790
return "MASKED"
@@ -1832,19 +1834,13 @@ def mask_func(data):
18321834
assert fetched_span["input"] == {"data": "MASKED"}
18331835
assert fetched_span["output"] == "MASKED"
18341836

1835-
# Test with faulty mask function
1836-
def faulty_mask_func(data):
1837-
raise Exception("Masking error")
1838-
1839-
langfuse = Langfuse(mask=faulty_mask_func)
1840-
18411837
# Create a root span with trace properties
18421838
with langfuse.start_as_current_span(name="test-span") as root_span:
1843-
root_span.update_trace(name="test_trace", input={"sensitive": "data"})
1839+
root_span.update_trace(name="test_trace", input={"should_raise": "data"})
18441840
# Get trace ID for later use
18451841
trace_id = root_span.trace_id
18461842
# Add output to the trace
1847-
root_span.update_trace(output={"more": "sensitive"})
1843+
root_span.update_trace(output={"should_raise": "sensitive"})
18481844

18491845
# Ensure data is sent
18501846
langfuse.flush()

0 commit comments

Comments
 (0)