claude37-unit-test-gen
Using Claude 3.7 to generate unit tests for code.
https://github.com/theopensciencenerd/claude37-unit-test-gen
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 4 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.8%) to scientific vocabulary
Repository
Using Claude 3.7 to generate unit tests for code.
Basic Info
- Host: GitHub
- Owner: TheOpenScienceNerd
- License: mit
- Language: Python
- Default Branch: main
- Size: 39.1 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
Generating Python Unit-Tests using Claude 3.7 Sonnet.
🎓 This tutorial aims provides an example generic system prompt for Claude 3.7 to support unit-testing in python. By following the tutorial you will:
- ✅ Gain an understanding of system prompting
- ✅ Understand different types of unit tests that can be generated
- ✅ Learn how to limit the number of tests generated to allow for human-in-the-loop checking
License
The materials have been made available under an MIT license. The materials are as-is with no liability for the author. Please provide credit if you reuse the code in your own work.
Citation
If you reuse any of the code, or the tutorial helps you work, please provide a citation.
bibtex
@software{TheOpenScienceNerd_Claude_UnitTests,
author = {Monks, Thomas},
license = {MIT},
title = {{TheOpenScienceNerd - Generating Python Unit-Tests using Claude 3.7 Sonnet}},
url = {https://github.com/TheOpenScienceNerd/tosn_python_template},
publisher = {Zenodo},
doi = {10.5281/zenodo.15206902},
}
Installation instructions
Installing dependencies
All dependencies can be found in binder/environment.yml and are pulled from conda-forge. To run the code locally, we recommend installing miniforge;
miniforge is Free and Open Source Software (FOSS) alternative to Anaconda and miniconda that uses conda-forge as the default channel for packages. It installs both conda and mamba (a drop in replacement for conda) package managers. We recommend mamba for faster resolving of dependencies and installation of packages.
navigating your terminal (or cmd prompt) to the directory containing the repo and issuing the following command:
bash
mamba env create -f binder/environment.yml
Activate the mamba environment using the following command:
bash
mamba activate unit_test
Repo overview
.
├── binder
│ └── environment.yml
├── prompts
│ └── 01_prompt.md
│ └── ...
├── CHANGELOG.md
├── CITATION.cff
├── LICENSE
├── metrics.py
├── test_metrics.py
└── README.md
binder/environment.yml- contains the conda environment if you wish to run the unit-testsprompts- directory containing prompts including example system promptmetrics.py- example code to testtest_metrics.py- example unit tests formetrics.pyCHANGES.md- changelog with record of notable changes to project between versions.CITATION.cff- citation information for the code.LICENSE- details of the MIT permissive license of this work.
Owner
- Name: TheOpenScienceNerd
- Login: TheOpenScienceNerd
- Kind: organization
- Location: United Kingdom
- Website: https://www.youtube.com/@TheOpenScienceNerd
- Repositories: 1
- Profile: https://github.com/TheOpenScienceNerd
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: TheOpenScienceNerd - Generating Python Unit-Tests using Claude 3.7 Sonnet
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: 'Thomas '
family-names: Monks
affiliation: University of Exeter
orcid: 'https://orcid.org/0000-0003-2631-4481'
repository-code: 'https://github.com/TheOpenScienceNerd/claude37-unit-test-gen'
keywords:
- python
- open science
- ClaudeAI
- Unit Testing
- pytest
license: MIT
GitHub Events
Total
- Release event: 1
- Push event: 3
- Public event: 1
- Create event: 1
Last Year
- Release event: 1
- Push event: 3
- Public event: 1
- Create event: 1