Skip to content

Commit 895e1da

Browse files
committed
Publish HW5
1 parent 7ec1d91 commit 895e1da

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

assignments/hw5.md

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,17 @@ layout: page
33
title: HW05 Hypothesis
44
permalink: assignments/hw5
55
parent: Assignments
6-
published: false
76
---
87

9-
# Homework 5
10-
11-
**Due Friday Mar 15th at 4:00pm EST**{: .label .label-red }
8+
# Homework 5 **Due Monday Mar 17th at 2pm EDT**{: .label .label-red }
129

1310
In this homework, you will use Hypothesis, a property-based testing tool, to find an obscure-ish bug in Wordle.
1411

1512
Please read the entire assignment in full before you begin. You might find some helpful information in the [Resources](#resources) section.
1613

1714
## Learning goals
1815

19-
- Think of a property that should always hold for function `is_yellow`.
16+
- Think of a property that should always hold for function `is_yellow`
2017
- Describe the property in your own words
2118
- Use Hypothesis to implement your property test for `is_yellow`
2219
- Find an obscure Wordle bug using Hypothesis
@@ -28,32 +25,28 @@ For this assignment, you will test a buggy version of Wordle using Hypothesis an
2825
You will perform the following tasks. You can use Codespaces for this assignment.
2926

3027
- Install Hypothesis
31-
- Setup your `hw5` folder
3228
- Define your `is_yellow` property in your own words
3329
- Implement your property in `wordle_parts_test.py`
3430
- Find the bug using Hypothesis
3531
- Bonus Challenge: Fix the bug!
3632

37-
### Install Hypothesis
33+
### Create homework repo via GitHub Classroom
3834

39-
Using the terminal in your homework repo:
35+
Your first step for this project is to create your repository that you will be working in for this assignment. You should create a repository via GitHub Classroom using this link: <https://classroom.github.com/a/IP-I2JCx> After accepting the homework, GitHub Classroom will create a repo named `cmu-crafting-software/2025-homework05-$YOUR_GITHUB_ID`.
4036

37+
You'll need to install a couple packages. To do so, use [uv](https://docs.astral.sh/uv/):
38+
39+
```sh
40+
uv init
41+
uv add hypothesis pytest
4142
```
42-
pip install hypothesis
43-
```
4443

45-
### Setup your `hw5` folder
44+
When you run these commands, VS Code should ask if you want to activate the virtual environment in the `.venv` folder that uv just created; click **Yes**. (Also, if any of the above terminal commands don't work, run the VS Code **Codespaces: Rebuild Container** command and then try again.)
45+
46+
Please also create a `README.md` file with the following information:
4647

47-
1. In your homework repo:
48-
```
49-
mkdir hw5
50-
cd hw5
51-
```
52-
2. Dowload the following files into `hw5`:
53-
- Buggy Wordle: `wordle_parts_buggy.py` <https://gist.githubusercontent.com/cmumatt/d8973817349b243a88b034c654c7fda9/raw/c4ecd84b4c2c6119ea70ef13e70c69b595361093/wordle_parts_buggy.py>
54-
- Starter test code: `wordle_parts_test.py` <https://gist.githubusercontent.com/cmumatt/75fbf9d12b703a2021666db38adc3123/raw/912127dad10aca9796f00110173a227ff04dfc2f/wordle_parts_test.py>
55-
3. Create a blank `README.md` in `hw5`
56-
4. Stage, commit, and push to the remote repository
48+
- The title of the homework (`# Homework 5`)
49+
- Your name and Andrew ID
5750

5851
### Define your `is_yellow` property in your own words
5952

@@ -69,15 +62,15 @@ Write a short test in function `test_is_yellow_pbt` that you think might find th
6962
7063
### Find the bug using Hypothesis
7164

72-
To execute Hypothesis, run `pytest` in terminal with `hw5` as your current working directory.
65+
To execute Hypothesis, run `uv run pytest` in your terminal.
7366

7467
If all tests pass, Hypothesis will say the tests passed (meaning it didn't find the bug). If a test fails, Hypothesis will show you a single example as well as the assertion that failed. The documentation (see Resources) also explains this.
7568

7669
When you find the bug, update `README.md` with:
7770

78-
- The counter-example Hypothesis found
79-
- Describe your experience trying to find the bug. Do you think this might be harder or easier than manually thinking of test cases?
80-
- Is there anything that you liked or disliked about using Hypothesis? How do you think it could be better or easier to use?
71+
- The counter-example Hypothesis found.
72+
- A description of your experience trying to find the bug. Do you think this might be harder or easier than manually thinking of test cases?
73+
- Anything that you liked or disliked about using Hypothesis. How do you think it could be better or easier to use?
8174

8275
> **Note**: If your property didn't find a bug, you should consider other properties to test.
8376
@@ -98,6 +91,6 @@ You can assume that `is_green` and `is_red` are correctly implemented. If you ge
9891

9992
## Deadlines and Deliverables
10093

101-
**Due Date**: Friday March 15th at 4:00pm EST
94+
**Due Date**: Monday March 17th at 2pm EDT
10295

103-
The deliverable should be committed and pushed to the main branch of your repository on GitHub inside a `hw5` subdirectory.
96+
The deliverable should be committed and pushed to the main branch of your repository on GitHub.

0 commit comments

Comments
 (0)