Skip to content

Commit f83f694

Browse files
authored
Merge pull request #23 from prcutler/master
Fix wrong word in pytest chapter introduction in transcripts
2 parents 778f75f + 7b7cc9e commit f83f694

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

transcripts/10-testing/1.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
00:15 which lets you guess a number from the command line.
99
00:18 And although is a simple program,
1010
00:20 it has a lot to offer in showing how to use pytest,
11-
00:24 for example to fall out of errors,
11+
00:24 for example to validate errors,
1212
00:26 capture standard output,
1313
00:28 mocking certain functionality, and more.
1414
00:31 By writing the test, I will also show you

transcripts/10-testing/5.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@
99
00:26 What I do need is to import the actual program.
1010
00:29 So from guess import get random number and the game class.
1111
00:35 Now, one thing I want to show you in this video is how to
12-
00:38 mark an object. Because Get Random Number, as you can see
12+
00:38 mock an object. Because Get Random Number, as you can see
1313
00:42 at the right, uses a random integer from start to end.
1414
00:45 And random returns to something randomly every time.
1515
00:49 So how do you actually test that? And the way to do that
16-
00:52 in testing land is to mark an object.
16+
00:52 in testing land is to mock an object.
1717
00:54 And for this I'm just going to use the unittest
18-
00:57 patch method on the mark module
18+
00:57 patch method on the mock module
1919
01:00 because it's a perfect fit for this scenario.
20-
01:05 So from unittest.mark, import patch.
20+
01:05 So from unittest.mock, import patch.
2121
01:10 I actually need to import to random module
22-
01:12 because that's the one we're going to mark.
22+
01:12 because that's the one we're going to mock.
2323
01:15 And you can use it as patch object
2424
01:20 and that's to random module. Just specify the function
2525
01:24 or method you want to patch.
@@ -38,7 +38,7 @@
3838
02:14 cannot really control and I have another example later
3939
02:17 about the input function where we ask for user input,
4040
02:21 which is another area that can be anything,
41-
02:24 so you want to mark that out.
41+
02:24 so you want to mock that out.
4242
02:27 So with this code written,
4343
02:28 let's go back to the command line and run this test.
4444
02:31 And I'm using Control Z on a Mac with foreground to

0 commit comments

Comments
 (0)