test_commands.py 507 B

123456789101112131415161718192021
  1. from src.commands import COMMANDS
  2. def test_help_returns_nonempty_string():
  3. result = COMMANDS["help"]()
  4. assert isinstance(result, str)
  5. assert len(result) > 0
  6. def test_help_mentions_help_command():
  7. result = COMMANDS["help"]()
  8. assert "help" in result
  9. def test_unknown_command_not_in_registry():
  10. assert "foobar" not in COMMANDS
  11. def test_all_commands_are_callable():
  12. for name, handler in COMMANDS.items():
  13. assert callable(handler), f"Command '{name}' is not callable"