You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: assignments/hw5.md
+20-27Lines changed: 20 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,20 +3,17 @@ layout: page
3
3
title: HW05 Hypothesis
4
4
permalink: assignments/hw5
5
5
parent: Assignments
6
-
published: false
7
6
---
8
7
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 }
12
9
13
10
In this homework, you will use Hypothesis, a property-based testing tool, to find an obscure-ish bug in Wordle.
14
11
15
12
Please read the entire assignment in full before you begin. You might find some helpful information in the [Resources](#resources) section.
16
13
17
14
## Learning goals
18
15
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`
20
17
- Describe the property in your own words
21
18
- Use Hypothesis to implement your property test for `is_yellow`
22
19
- 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
28
25
You will perform the following tasks. You can use Codespaces for this assignment.
29
26
30
27
- Install Hypothesis
31
-
- Setup your `hw5` folder
32
28
- Define your `is_yellow` property in your own words
33
29
- Implement your property in `wordle_parts_test.py`
34
30
- Find the bug using Hypothesis
35
31
- Bonus Challenge: Fix the bug!
36
32
37
-
### Install Hypothesis
33
+
### Create homework repo via GitHub Classroom
38
34
39
-
Using the terminal in your homeworkrepo:
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`.
40
36
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
41
42
```
42
-
pip install hypothesis
43
-
```
44
43
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:
- 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
57
50
58
51
### Define your `is_yellow` property in your own words
59
52
@@ -69,15 +62,15 @@ Write a short test in function `test_is_yellow_pbt` that you think might find th
69
62
70
63
### Find the bug using Hypothesis
71
64
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.
73
66
74
67
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.
75
68
76
69
When you find the bug, update `README.md` with:
77
70
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?
81
74
82
75
> **Note**: If your property didn't find a bug, you should consider other properties to test.
83
76
@@ -98,6 +91,6 @@ You can assume that `is_green` and `is_red` are correctly implemented. If you ge
98
91
99
92
## Deadlines and Deliverables
100
93
101
-
**Due Date**: Friday March 15th at 4:00pm EST
94
+
**Due Date**: Monday March 17th at 2pm EDT
102
95
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