File size: 1,988 Bytes
212d694
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import unittest
from mediaunmasked.analyzers.evidence_analyzer import EvidenceAnalyzer
import logging

class TestEvidenceAnalyzer(unittest.TestCase):
    def setUp(self):
        self.analyzer = EvidenceAnalyzer()
        logging.basicConfig(level=logging.INFO)
        self.logger = logging.getLogger(__name__)

    def test_well_supported_content(self):
        """Test content with strong evidence"""
        text = """According to the WHO study, vaccination rates have increased by 25%. 
        Research published in Nature shows significant results. The data from multiple 
        studies indicates a clear trend, as reported in the scientific journal."""
        
        result = self.analyzer.analyze(text)
        
        self.assertIsNotNone(result)
        self.assertGreater(result['evidence_based_score'], 70)
        self.logger.info(f"Well-supported content score: {result}")

    def test_poorly_supported_content(self):
        """Test content with weak evidence"""
        text = """Some people say this treatment works wonders. Many believe it's the 
        best solution available. Sources claim it could be revolutionary."""
        
        result = self.analyzer.analyze(text)
        
        self.assertIsNotNone(result)
        self.assertLess(result['evidence_based_score'], 50)
        self.logger.info(f"Poorly-supported content score: {result}")

    def test_mixed_evidence_content(self):
        """Test content with mixed evidence quality"""
        text = """According to recent studies, the treatment shows promise. Some experts 
        claim it could be effective, while research published in medical journals 
        indicates more testing is needed."""
        
        result = self.analyzer.analyze(text)
        
        self.assertIsNotNone(result)
        self.assertGreater(result['evidence_based_score'], 30)
        self.assertLess(result['evidence_based_score'], 80)
        self.logger.info(f"Mixed evidence content score: {result}")