When 100% Test Coverage Isn’t Enough
📰 Medium · Data Science
100% test coverage isn't enough to ensure code quality, learn how to improve testing with concrete examples
Action Steps
- Write a test suite for the clean_text function using a testing framework like unittest
- Use a code coverage tool like coverage.py to measure test coverage
- Identify edge cases and write additional tests to cover them
- Use a testing library like hypothesis to generate test cases and improve test coverage
- Refactor the clean_text function to make it more testable and maintainable
Who Needs to Know This
Developers and QA engineers can benefit from understanding the limitations of test coverage and how to write more effective tests to ensure code quality
Key Insight
💡 Test coverage is not a perfect measure of code quality, and writing effective tests requires considering edge cases and using the right tools
Share This
💡 100% test coverage isn't enough! Learn how to improve testing with concrete examples #testing #codequality
Key Takeaways
100% test coverage isn't enough to ensure code quality, learn how to improve testing with concrete examples
Full Article
Title: When 100% Test Coverage Isn’t Enough
URL Source: https://medium.com/@oral.ersoy.dokumaci/when-100-test-coverage-isnt-enough-9faed3a2875c?source=rss------data_science-5
Published Time: 2026-04-12T19:50:25Z
Markdown Content:
# When 100% Test Coverage Isn’t Enough | by Oral Ersoy Dokumaci | Apr, 2026 | Medium
[Sitemap](https://medium.com/sitemap/sitemap.xml)
[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)
[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)
Get app
[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)
[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

# When 100% Test Coverage Isn’t Enough
[](https://medium.com/@oral.ersoy.dokumaci?source=post_page---byline--9faed3a2875c---------------------------------------)
[Oral Ersoy Dokumaci](https://medium.com/@oral.ersoy.dokumaci?source=post_page---byline--9faed3a2875c---------------------------------------)
Follow
19 min read
·
6 hours ago
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2F9faed3a2875c&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&user=Oral+Ersoy+Dokumaci&userId=bb410b2f21f1&source=---header_actions--9faed3a2875c---------------------clap_footer------------------)
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2F9faed3a2875c&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&source=---header_actions--9faed3a2875c---------------------bookmark_footer------------------)
[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3D9faed3a2875c&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&source=---header_actions--9faed3a2875c---------------------post_audio_button------------------)
Share
Press enter or click to view image in full size

## Introduction
Suppose you are working in NLP or AI like half of the world including myself. You want to do some text cleaning to prepare training data for a multi-language model. Your goal is to remove text with duplicate meaning within each language. So you “write” a quick cleaning function, even dusting off the ancient language of regex that was once known to humans but only spoken by LLMs these days.
import re
def clean_text(text: str) -> str:
"""Normalize text for dedup."""
text = text.strip()
text = text.lower()
text = re.sub(r"\s+", " ", text) # collapse whitespace
text = re.sub(r"[^\w\s]", " ", text) # replace punctuation
return text
You run the function on an example input.
$ python -c "from preprocess import clean_text; print(clean_t
URL Source: https://medium.com/@oral.ersoy.dokumaci/when-100-test-coverage-isnt-enough-9faed3a2875c?source=rss------data_science-5
Published Time: 2026-04-12T19:50:25Z
Markdown Content:
# When 100% Test Coverage Isn’t Enough | by Oral Ersoy Dokumaci | Apr, 2026 | Medium
[Sitemap](https://medium.com/sitemap/sitemap.xml)
[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)
[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)
Get app
[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)
[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

# When 100% Test Coverage Isn’t Enough
[](https://medium.com/@oral.ersoy.dokumaci?source=post_page---byline--9faed3a2875c---------------------------------------)
[Oral Ersoy Dokumaci](https://medium.com/@oral.ersoy.dokumaci?source=post_page---byline--9faed3a2875c---------------------------------------)
Follow
19 min read
·
6 hours ago
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2F9faed3a2875c&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&user=Oral+Ersoy+Dokumaci&userId=bb410b2f21f1&source=---header_actions--9faed3a2875c---------------------clap_footer------------------)
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2F9faed3a2875c&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&source=---header_actions--9faed3a2875c---------------------bookmark_footer------------------)
[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3D9faed3a2875c&operation=register&redirect=https%3A%2F%2Fmedium.com%2F%40oral.ersoy.dokumaci%2Fwhen-100-test-coverage-isnt-enough-9faed3a2875c&source=---header_actions--9faed3a2875c---------------------post_audio_button------------------)
Share
Press enter or click to view image in full size

## Introduction
Suppose you are working in NLP or AI like half of the world including myself. You want to do some text cleaning to prepare training data for a multi-language model. Your goal is to remove text with duplicate meaning within each language. So you “write” a quick cleaning function, even dusting off the ancient language of regex that was once known to humans but only spoken by LLMs these days.
import re
def clean_text(text: str) -> str:
"""Normalize text for dedup."""
text = text.strip()
text = text.lower()
text = re.sub(r"\s+", " ", text) # collapse whitespace
text = re.sub(r"[^\w\s]", " ", text) # replace punctuation
return text
You run the function on an example input.
$ python -c "from preprocess import clean_text; print(clean_t
DeepCamp AI