-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock.py
92 lines (61 loc) · 1.97 KB
/
mock.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# -*- coding: utf-8 -*-
class MMock(object):
def __getattr__(self, item):
class Mock(object):
def __init__(self, *args, **kwargs):
pass
def __getitem__(self, item):
return Mock()
def __setitem__(self, key, value):
pass
def __getattr__(self, item):
return Mock()
def __call__(self, *args, **kwargs):
return Mock()
def __enter__(self):
return Mock()
def __exit__(self, exc_type, exc_val, exc_tb):
return Mock()
def __iter__(self):
yield Mock()
def __contains__(self, item):
return Mock()
def __get__(self, instance, owner):
return Mock()
def __set__(self):
pass
def __del__(self):
pass
def __add__(self, other):
return Mock()
def __sub__(self, other):
return Mock()
def __mod__(self, other):
return Mock()
def __mul__(self, other):
return Mock()
def __neg__(self):
return Mock()
def __nonzero__(self):
return True
def __and__(self, other):
return Mock()
def __or__(self, other):
return Mock()
def __abs__(self):
return Mock()
def __cmp__(self, other):
return Mock()
def __eq__(self, other):
return Mock()
def __complex__(self):
return Mock()
def __gt__(self, other):
return Mock()
def __lt__(self, other):
return Mock()
def __len__(self):
return Mock()
return Mock()
import sys
sys.modules[__name__] = MMock()