We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2b5654f commit 6f5f3a3Copy full SHA for 6f5f3a3
test/mocknull.py
@@ -0,0 +1,21 @@
1
+
2
+class MockNull:
3
+ def __init__(self, **kwargs):
4
+ for key, value in kwargs.items():
5
+ self.__dict__[key] = value
6
7
+ def __call__(self, *args, **kwargs): return MockNull()
8
+ def __getattr__(self, name):
9
+ # This allows assignments which assume all intermediate steps are Null
10
+ # objects if they don't exist yet.
11
+ #
12
+ # For example (with just 'client' defined):
13
14
+ # client.db.config.TRACKER_WEB = 'BASE/'
15
+ self.__dict__[name] = MockNull()
16
+ return getattr(self, name)
17
18
+ def __getitem__(self, key): return self
19
+ def __nonzero__(self): return 0
20
+ def __str__(self): return ''
21
+ def __repr__(self): return '<MockNull 0x%x>'%id(self)
0 commit comments