global-function

How to mock a free function in python?

I have a python program with a global function that is painful to test (it needs a large dataset to work properly). What is the best way to get around this while testing functions that call it? I've found that the following works (but it make me feel dirty to use it). module foo: def PainLiesHere(): return 4; #guaranteed to be rando...