Skills Plugins MCP Prompt Model 博客 我的中心
开发编程 #python #testing

unittest-skill

Generates Python unittest tests. Built-in testing framework with TestCase, setUp/tearDown, and assertion methods. Use when user mentions "unittest", "TestCase", "self.assertEqual", "Python unittest". Triggers on: "unittest", "TestCase", "self.assertEqual", "Python unittest" (not pytest).

DeepseekModel 官方收录技能 质量 优秀 · 78 v1.0.0

获取

https://deepseekmodel.com/api/download.php?id=lambdatest-agent-skills-unittest-skill-skill-md&format=skill
下载 .skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用
.skill 文件中 system_prompt 字段的实际内容。
name unittest-skill description Generates Python unittest tests. Built-in testing framework with TestCase, setUp/tearDown, and assertion methods. Use when user mentions "unittest", "TestCase", "self.assertEqual", "Python unittest". Triggers on: "unittest", "TestCase", "self.assertEqual", "Python unittest" (not pytest). languages ["Python"] category unit-testing license MIT metadata {"author":"TestMu AI","version":"1.0"} Python unittest Skill Core Patterns Basic Test import unittest class TestCalculator (unittest.TestCase): def setUp ( self ): self .calc = Calculator() def test_add ( self ): self .assertEqual( self .calc.add( 2 , 3 ), 5 ) def test_divide_by_zero ( self ): with self .assertRaises(ZeroDivisionError): self .calc.divide( 10 , 0 ) def test_multiple_assertions ( self ): self .assertEqual( self .calc.add( 2 , 2 ), 4 ) self .assertEqual( self .calc.subtract( 5 , 3 ), 2 ) self .assertAlmostEqual( self .calc.divide( 10 , 3 ), 3.333 , places= 3 ) def tearDown ( self ): pass # cleanup if __name__ == '__main__' : unittest.main() Assertions self .assertEqual(a, b) self .assertNotEqual(a, b) self .assertTrue(condition) self .assertFalse(condition) self .assertIsNone(obj) self .assertIsNotNone(obj) self .assertIs(a, b) # same object self .assertIn(item, collection) self .assertNotIn(item, collection) self .assertIsInstance(obj, cls) self .assertAlmostEqual(a, b, places= 5 ) self .assertGreater(a, b) self .assertLess(a, b) self .assertRegex( str , r'\d+' ) self .assertCountEqual(a, b) # same elements, any order # Exception with self .assertRaises(ValueError) as ctx: raise ValueError( "bad" ) self .assertIn( "bad" , str (ctx.exception)) # Warning with self .assertWarns(DeprecationWarning): deprecated_function() SubTest (Parameterized) def test_add_multiple ( self ): test_cases = [( 2 , 3 , 5 ), (- 1 , 1 , 0 ), ( 0 , 0 , 0 )] for a, b, expected in test_cases: with self .subTest(a=a, b=b): self .assertEqual( self .calc.add(a, b), expected) Mocking from unittest.mock import patch, MagicMock, Mock class TestUserService (unittest.TestCase): @patch( 'myapp.service.UserRepository' ) @patch( 'myapp.service.EmailService' ) def test_create_user ( self, MockEmail, MockRepo ): mock_repo = MockRepo.return_value mock_repo.save.return_value = User( 1 , 'Alice' ) service = UserService() result = service.create_user( 'alice@test.com' , 'Alice' ) self .assertEqual(result. id , 1 ) mock_repo.save.assert_called_once() MockEmail.return_value.send_welcome.assert_called_with( 'alice@test.com' ) Lifecycle setUpClass() → Once before all tests (classmethod) setUp() → Before each test test_method() → Test tearDown() → After each test tearDownClass() → Once after all tests (classmethod) Run: python -m unittest or python -m unittest test_module.TestClass.test_method Discover: python -m unittest discover -s tests -p "test_*.py" Deep Patterns For advanced patterns, debugging guides, CI/CD integration, and best practices, see reference/playbook.md .
Agent 识别该技能的关键词,点击任意一个即可复制。

该技能未提供触发词。

下载的 .skill 包内含以下字段。
字段 说明
format格式标识(skill/v1)
skill_id技能唯一 ID
name技能名称
version版本号
description技能描述
category所属分类(数组)
trigger_words触发词列表
tags标签列表
source来源标识
source_url来源链接(本页地址)
exported_at导出时间(每次下载生成)
system_prompt系统提示词正文
model_config模型参数:provider / model / temperature / max_tokens / top_p
examples示例
install_guide各平台导入说明(Coze / Dify / Claude / 自定义框架)
同一份技能可按不同平台格式导出。
.skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用 下载
.skillpro 增强格式,额外含脚本 / 工具 / 依赖 / 钩子占位 下载
.json 纯 JSON 导出,只含 system_prompt 与模型参数 下载
Coze 带 frontmatter 的 Markdown,Coze 平台导入用 下载
Dify Dify DSL,创建应用后直接导入 下载

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。