@@ -24,7 +24,7 @@ def test_models():
2424 domain_specificity = "specialized" ,
2525 implementation_scope = "full_system" ,
2626 existing_knowledge = "limited" ,
27- innovation_level = "cutting_edge"
27+ innovation_level = "cutting_edge" ,
2828 )
2929 print (f"✅ ResearchComplexityFactors created: { factors .technical_complexity } " )
3030
@@ -34,9 +34,11 @@ def test_models():
3434 expected_url_count = 5 ,
3535 minimum_url_count = 3 ,
3636 reasoning = "Complex authentication system requires multiple sources" ,
37- quality_criteria = ["security best practices" , "proven implementation patterns" ]
37+ quality_criteria = ["security best practices" , "proven implementation patterns" ],
38+ )
39+ print (
40+ f"✅ ResearchRequirementsAnalysis created: { analysis .expected_url_count } URLs expected"
3841 )
39- print (f"✅ ResearchRequirementsAnalysis created: { analysis .expected_url_count } URLs expected" )
4042
4143 # Test URLValidationResult
4244 validation = URLValidationResult (
@@ -45,7 +47,7 @@ def test_models():
4547 expected_count = 5 ,
4648 minimum_count = 3 ,
4749 adequacy_reasoning = "Good coverage of security patterns, missing performance considerations" ,
48- quality_assessment = "High quality sources from established authorities"
50+ quality_assessment = "High quality sources from established authorities" ,
4951 )
5052 print (f"✅ URLValidationResult created: adequate={ validation .is_adequate } " )
5153
@@ -59,12 +61,15 @@ def test_models():
5961 expected_url_count = 5 ,
6062 minimum_url_count = 3 ,
6163 url_requirement_reasoning = "Testing dynamic URLs" ,
62- research_complexity_analysis = analysis
64+ research_complexity_analysis = analysis ,
65+ )
66+ print (
67+ f"✅ TaskMetadata with dynamic URLs: { metadata .expected_url_count } /{ metadata .minimum_url_count } "
6368 )
64- print (f"✅ TaskMetadata with dynamic URLs: { metadata .expected_url_count } /{ metadata .minimum_url_count } " )
6569
6670 print ("🎉 All model tests passed!" )
6771
72+
6873async def test_analyzer_mock ():
6974 """Test the ResearchRequirementsAnalyzer with a mock scenario."""
7075 print ("\n 🧪 Testing ResearchRequirementsAnalyzer..." )
@@ -89,20 +94,27 @@ async def test_analyzer_mock():
8994 domain_specificity = "security" ,
9095 implementation_scope = "authentication_system" ,
9196 existing_knowledge = "moderate" ,
92- innovation_level = "standard"
97+ innovation_level = "standard" ,
9398 ),
9499 expected_url_count = 4 ,
95100 minimum_url_count = 2 ,
96101 reasoning = "Security-focused authentication requires multiple authoritative sources" ,
97- quality_criteria = ["security best practices" , "JWT standards" , "authentication patterns" ]
102+ quality_criteria = [
103+ "security best practices" ,
104+ "JWT standards" ,
105+ "authentication patterns" ,
106+ ],
107+ )
108+ print (
109+ f"✅ Fallback analysis: { fallback_analysis .expected_url_count } URLs expected"
98110 )
99- print (f"✅ Fallback analysis: { fallback_analysis .expected_url_count } URLs expected" )
100111
101112 except Exception as e :
102113 print (f"❌ Error in analyzer test: { e } " )
103114
104115 print ("🎉 Analyzer structure test passed!" )
105116
117+
106118def test_url_validation ():
107119 """Test URL validation logic."""
108120 print ("\n 🧪 Testing URL validation..." )
@@ -111,34 +123,47 @@ def test_url_validation():
111123 test_cases = [
112124 {
113125 "name" : "Adequate URLs" ,
114- "provided" : ["https://auth0.com/blog" , "https://jwt.io/introduction" , "https://owasp.org/auth" ],
126+ "provided" : [
127+ "https://auth0.com/blog" ,
128+ "https://jwt.io/introduction" ,
129+ "https://owasp.org/auth" ,
130+ ],
115131 "expected" : 3 ,
116- "minimum" : 2
132+ "minimum" : 2 ,
117133 },
118134 {
119135 "name" : "Below minimum" ,
120136 "provided" : ["https://auth0.com/blog" ],
121137 "expected" : 4 ,
122- "minimum" : 2
138+ "minimum" : 2 ,
123139 },
124140 {
125141 "name" : "Above expected" ,
126- "provided" : ["https://auth0.com/blog" , "https://jwt.io" , "https://owasp.org" , "https://security.com" , "https://rfc7519.com" ],
142+ "provided" : [
143+ "https://auth0.com/blog" ,
144+ "https://jwt.io" ,
145+ "https://owasp.org" ,
146+ "https://security.com" ,
147+ "https://rfc7519.com" ,
148+ ],
127149 "expected" : 3 ,
128- "minimum" : 2
129- }
150+ "minimum" : 2 ,
151+ },
130152 ]
131153
132154 for case in test_cases :
133155 provided_count = len (case ["provided" ])
134156 is_adequate = provided_count >= case ["minimum" ]
135157 meets_expected = provided_count >= case ["expected" ]
136158
137- print (f"📊 { case ['name' ]} : { provided_count } URLs (min: { case ['minimum' ]} , expected: { case ['expected' ]} )" )
159+ print (
160+ f"📊 { case ['name' ]} : { provided_count } URLs (min: { case ['minimum' ]} , expected: { case ['expected' ]} )"
161+ )
138162 print (f" Adequate: { is_adequate } , Meets Expected: { meets_expected } " )
139163
140164 print ("✅ URL validation logic tests passed!" )
141165
166+
142167def main ():
143168 """Run all tests."""
144169 print ("🚀 Testing Dynamic URL Validation System" )
@@ -156,7 +181,9 @@ def main():
156181 except Exception as e :
157182 print (f"\n ❌ TEST FAILED: { e } " )
158183 import traceback
184+
159185 traceback .print_exc ()
160186
187+
161188if __name__ == "__main__" :
162189 main ()
0 commit comments