<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Unittest on AI VOID</title><link>https://ai-blog.noorshomelab.dev/tags/unittest/</link><description>Recent content in Unittest on AI VOID</description><generator>Hugo</generator><language>en</language><lastBuildDate>Wed, 03 Dec 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://ai-blog.noorshomelab.dev/tags/unittest/index.xml" rel="self" type="application/rss+xml"/><item><title>Testing Your Code with `unittest` and `pytest`</title><link>https://ai-blog.noorshomelab.dev/python-mastery-2025/chapter-19-testing-your-code-unittest-pytest/</link><pubDate>Wed, 03 Dec 2025 00:00:00 +0000</pubDate><guid>https://ai-blog.noorshomelab.dev/python-mastery-2025/chapter-19-testing-your-code-unittest-pytest/</guid><description>&lt;h2 id="introduction-to-testing-your-code"&gt;Introduction to Testing Your Code&lt;/h2&gt;
&lt;p&gt;Welcome back, future Pythonista! So far, you&amp;rsquo;ve learned to write amazing Python code, build functions, create classes, and even handle errors. But how do you &lt;em&gt;know&lt;/em&gt; your code actually works as intended, especially as it grows more complex? How do you ensure that adding a new feature doesn&amp;rsquo;t accidentally break an old one?&lt;/p&gt;
&lt;p&gt;The answer, my friend, is &lt;strong&gt;testing&lt;/strong&gt;! In this chapter, we&amp;rsquo;re going to dive into the incredibly important world of unit testing in Python. You&amp;rsquo;ll learn how to write small, focused tests for individual pieces of your code, giving you confidence that your programs are robust and reliable. We&amp;rsquo;ll explore Python&amp;rsquo;s built-in testing framework, &lt;code&gt;unittest&lt;/code&gt;, and then introduce you to &lt;code&gt;pytest&lt;/code&gt;, a hugely popular and powerful third-party testing tool that many developers prefer.&lt;/p&gt;</description></item></channel></rss>