replace not replacing random module
Bug #1293530 reported by
Zalán Somogyváry
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mocker |
New
|
Undecided
|
Unassigned |
Bug Description
Hello!
I'm unable to replace the random module through mocker.
randint_stub = mocker.
randint_stub(ANY, ANY)
mocker.count(1)
If I do this I always get:
Unmet expectations:
=> random.randint(ANY, ANY)
- Performed fewer times than expected.
To post a comment you must log in.
Try this...
import random
import mocker
mocker = mocker.Mocker() replace( random) mock.randint( 1, 5)
random_mock = mocker.
random_
mocker.result(9)
mocker.replay()
random.randint(1, 5)