Skip to content

Add unit tests for scenario module#1

Open
cstefanache wants to merge 2 commits into
mainfrom
unit-tests
Open

Add unit tests for scenario module#1
cstefanache wants to merge 2 commits into
mainfrom
unit-tests

Conversation

@cstefanache

Copy link
Copy Markdown
Owner

This PR adds comprehensive unit tests for the scenario module, including validation tests for all Pydantic models and functionality tests for loading scenarios from YAML files.

@cstefanache

Copy link
Copy Markdown
Owner Author

Code review comments:\n\n1. Consider adding more edge case tests for validation scenarios\n2. Use parametrized tests where possible to reduce code duplication\n3. The test_load_scenario function uses temporary files; consider mocking file operations instead\n4. Add more detailed docstrings explaining what each test validates\n5. Test empty lists and None values in configurations

- Use @pytest.mark.parametrize to reduce duplication across dtype, role,
  label, name, and token-count tests
- Replace tempfile usage in test_load_scenario with unittest.mock.patch
  to avoid real filesystem access
- Add detailed docstrings to every test explaining what is validated
- Add edge case tests: empty lists, None values, boundary values (top_k_probs=0,
  max_new_tokens=1), backslash/tab/newline in labels and names
- Add tests for ModelConfig defaults, gguf_file=None, device literals,
  GenerationConfig optional fields, CaptureConfig layers variants,
  OutputConfig custom dir, Scenario reference_states, and load_scenario
  error paths (invalid YAML, missing required field)
- Grow test count from 8 to 76 passing tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant