🏠 ホーム
ベンチマーク
📊 すべてのベンチマーク 🦖 恐竜 v1 🦖 恐竜 v2 ✅ To-Doリストアプリ 🎨 クリエイティブフリーページ 🎯 FSACB - アルティメットショーケース 🌍 翻訳ベンチマーク
モデル
🏆 トップ10モデル 🆓 無料モデル 📋 すべてのモデル ⚙️ 🛠️ Kilo Code モード
リソース
💬 💬 プロンプトライブラリ 📖 📖 AI用語集 🔗 🔗 有用なリンク
intermediate

Generate Python Unit Tests

#python #testing #code-generation

Create comprehensive unit tests for a Python function using the unittest framework.

Act as a Python developer. Write a set of unit tests using the unittest framework for the following function. Include test cases for standard inputs, edge cases, and error handling. Function: def calculate_discount(price, discount_rate): if not 0 <= discount_rate <= 1: raise ValueError("Invalid discount rate") return price * (1 - discount_rate)