Coverage for intelligence_toolkit/tests/unit/AI/test_validation_prompt.py: 100%

26 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-10-16 13:41 -0300

1# Copyright (c) 2024 Microsoft Corporation. All rights reserved. 

2# Licensed under the MIT license. See LICENSE file in the project. 

3# 

4from intelligence_toolkit.AI.validation_prompt import GROUNDEDNESS_PROMPT 

5 

6 

7def test_groundedness_prompt_exists(): 

8 assert GROUNDEDNESS_PROMPT is not None 

9 assert isinstance(GROUNDEDNESS_PROMPT, str) 

10 assert len(GROUNDEDNESS_PROMPT) > 0 

11 

12 

13def test_groundedness_prompt_contains_key_instructions(): 

14 assert "AI assistant" in GROUNDEDNESS_PROMPT 

15 assert "coherence" in GROUNDEDNESS_PROMPT 

16 assert "report instructions" in GROUNDEDNESS_PROMPT 

17 assert "generated report" in GROUNDEDNESS_PROMPT 

18 

19 

20def test_groundedness_prompt_contains_rating_scale(): 

21 assert "5:" in GROUNDEDNESS_PROMPT 

22 assert "1:" in GROUNDEDNESS_PROMPT 

23 assert "score" in GROUNDEDNESS_PROMPT.lower() 

24 assert "explanation" in GROUNDEDNESS_PROMPT.lower() 

25 

26 

27def test_groundedness_prompt_contains_json_format_instruction(): 

28 assert "JSON format" in GROUNDEDNESS_PROMPT 

29 assert "score" in GROUNDEDNESS_PROMPT 

30 assert "explanation" in GROUNDEDNESS_PROMPT 

31 

32 

33def test_groundedness_prompt_contains_examples(): 

34 assert "Example Task" in GROUNDEDNESS_PROMPT 

35 assert "REPORT INSTRUCTIONS" in GROUNDEDNESS_PROMPT 

36 assert "GENERATED REPORT" in GROUNDEDNESS_PROMPT 

37 

38 

39def test_groundedness_prompt_mentions_data_accuracy(): 

40 assert "accurately" in GROUNDEDNESS_PROMPT.lower() or "accurate" in GROUNDEDNESS_PROMPT.lower() 

41 assert "data" in GROUNDEDNESS_PROMPT.lower()