Skip to content

Lesson: Test classes should not have docstrings #1896

@nathanjmcdougall

Description

@nathanjmcdougall

Context

When creating test classes for validate_or_raise, validate_or_default, validated_get, and ensure_get, each test class was given a docstring like """Tests for validate_or_raise.""". This is unnecessary and inconsistent with the project's conventions.

Root Cause

The agent applied general Python best practices (all classes should have docstrings) to test classes, where docstrings are redundant since the class name already conveys the purpose.

Principle

Test classes should not have docstrings. The class name (e.g., TestValidateOrRaise) already communicates what is being tested. Adding docstrings like """Tests for validate_or_raise.""" is redundant. This applies to both top-level test classes and nested test classes.

Affected Skills

The usethis-python-test skill should include guidance: do not add docstrings to test classes. The class name is sufficient documentation.

Metadata

Metadata

Labels

agentConfiguration updates for LLM coding agents

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions