def test_when_analyze_then_apptracer_has_value(loaded_registry, unit_test_guid, nlp_engine): text = "My name is Bart Simpson, and Credit card: 4095-2609-9393-4932, my phone is 425 8829090" # noqa E501 language = "en" entities = ["CREDIT_CARD", "PHONE_NUMBER", "PERSON"] app_tracer_mock = AppTracerMock(enable_interpretability=True) analyzer_engine_with_spacy = AnalyzerEngine( loaded_registry, app_tracer=app_tracer_mock, enable_trace_pii=True, nlp_engine=nlp_engine, ) results = analyzer_engine_with_spacy.analyze( correlation_id=unit_test_guid, text=text, entities=entities, language=language, all_fields=False, trace=True, ) assert len(results) == 3 for result in results: assert result.analysis_explanation is not None assert app_tracer_mock.get_msg_counter() == 2 assert app_tracer_mock.get_last_trace() is not None
def app_tracer(): return AppTracerMock(enable_decision_process=True)
def app_tracer(): return AppTracerMock(enable_interpretability=True)