1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

Automatically generate cassette names from function names. Add

`path_transformer` and `func_path_generator`. Closes #151.
This commit is contained in:
Ivan Malison
2015-05-10 03:22:43 -07:00
parent 0bbbc694b0
commit 2323b9da5f
6 changed files with 279 additions and 48 deletions

16
vcr/util.py Normal file
View File

@@ -0,0 +1,16 @@
def partition_dict(predicate, dictionary):
true_dict = {}
false_dict = {}
for key, value in dictionary.items():
this_dict = true_dict if predicate(key, value) else false_dict
this_dict[key] = value
return true_dict, false_dict
def compose(*functions):
def composed(incoming):
res = incoming
for function in functions[::-1]:
res = function(res)
return res
return composed