Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
About Article
Analyze Data
Archive
Best Practices
Better Outputs
Blog
Code Optimization
Code Quality
Command Line
Course
Daily tips
Dashboard
Data Analysis & Manipulation
Data Engineer
Data Visualization
DataFrame
Delta Lake
DevOps
DuckDB
Environment Management
Feature Engineer
Git
Jupyter Notebook
LLM
LLM Tools
Machine Learning
Machine Learning & AI
Machine Learning Tools
Manage Data
MLOps
Natural Language Processing
Newsletter Archive
NumPy
Pandas
Polars
PySpark
Python Helpers
Python Tips
Python Utilities
Scrape Data
SQL
Testing
Time Series
Tools
Visualization
Visualization & Reporting
Workflow & Automation
Workflow Automation

Testing

Efficiently Resume Work After Breaks with Failing Tests

Do you forget what feature to implement when taking a break from work?

To keep your train of thought, write a unit test that describes the desired behavior of the feature and makes it fail intentionally.

This will give you a clear idea of what to work on when returning to the project, allowing you to get back on track faster.

My previous tips on testing in Python.

Efficiently Resume Work After Breaks with Failing Tests Read More »

Write Readable Tests for Your Machine Learning Models with Behave

An accurate machine learning model can still cause problems if it exhibits unexpected behaviors not identified during testing.

For example, a sentiment analysis model may perform well during training, but upon deploying it, the model incorrectly labels certain positive reviews as negative when rephrasing using negative words. 

Testing the behaviors of an ML model can help us identify areas for improvement. This article and video will show you how to test the behaviors of your ML model with behave.

Article.

Video.

Write Readable Tests for Your Machine Learning Models with Behave Read More »

pyfakefs: Create Fake File System in Memory for Testing

Sometimes you might want to test if the function that interacts with files is working properly but don’t want the tests to touch the real disk.

pyfakefs allows your tests to operate on a file system in memory without touching the real disk.

In the code above, I created a fake directory and tested if create_file is creating a new file in the fake directory.

pyfakefs: Create Fake File System in Memory for Testing Read More »

pytest-picked: Run the Tests Related to the Unstaged Files in Git

It can be time-consuming to run all tests in your project. Wouldn’t it be nice if you can run only the tests related to the unstaged files in Git? That is when pytest-picked comes in handy.

In the code above, only tests in the file test_picked.py are executed because it is an unstaged file.

Link to pytest-picked.

My previous tips on testing in Python.

pytest-picked: Run the Tests Related to the Unstaged Files in Git Read More »

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran