test: add unit tests for NERService (Fixes #440)#897
Conversation
- 17 tests covering initialization, _clean_label parsing, regex patterns, extract_entities, and load behavior - Tests verify: BIO tag parsing, regex fallback for IP/hostname/VLAN/etc, empty text handling, load idempotency, missing model error - All ML dependencies mocked (torch, transformers)
|
@zeroknowledge0x is attempting to deploy a commit to the ritesh Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Review limit reached
More reviews will be available in 26 minutes and 34 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @zeroknowledge0x! 🙌 Thank you so much for your excellent contribution: "test: add unit tests for NERService (Fixes #440)"! We really appreciate the high-quality code and effort you have put into the platform. Just a quick, friendly heads-up as we prepare our manual merging and verification queues—please make sure to complete all the mandatory community steps listed below. Once those manual steps are verified, we'll get your PR officially merged into the Let's build something amazing together! 🚀🔥 🌟 Community Support & Network Steps (Take 10 Seconds!)As we prepare our manual verification and merging queues, please make sure you have taken a moment to complete these required steps to finalize your points:
Note: Having these steps completed manually is required before your PR points are officially cleared. |
|
Hi @zeroknowledge0x! 🙌 Thank you so much for your excellent contribution: "test: add unit tests for NERService (Fixes #440)"! We really appreciate the high-quality code and effort you have put into the platform. Just a quick, friendly heads-up as we prepare our manual merging and verification queues—please make sure to complete all the mandatory community steps listed below. Once those manual steps are verified, we'll get your PR officially merged into the Let's build something amazing together! 🚀🔥 🌟 Community Support & Network Steps (Take 10 Seconds!)As we prepare our manual verification and merging queues, please make sure you have taken a moment to complete these required steps to finalize your points:
Note: Having these steps completed manually is required before your PR points are officially cleared. |
Fixes #440
Summary
Adds unit tests for
NERServiceinbackend/services/ner_service.py. All 17 tests pass with ML dependencies mocked.Changes
backend/tests/test_ner_service.pywith 17 test cases_clean_label(): O tag, B-B-, I-B-, B-, I- prefixes, unknown labelsREGEX_PATTERNS: IP address, hostname, network error, VLAN, database, browserextract_entities(): empty text handling, regex fallback for IP addressesload(): idempotency, missing model errorTesting
Result: 17 passed in 0.26s
Test Coverage