Premiere version : mise en route du suivi.
[auf_roundup.git] / test / mocknull.py
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)
22 def gettext(self, str): return str
23 _ = gettext