def test_get_settable_properties(self): class SomeClass(object): regular_attr = 'regular_attr' _foo = 'foo' _bar = 'bar' @property def settable_prop(self): return self._foo @settable_prop.setter def settable_prop(self, new_foo): self._foo = new_foo @property def readonly_prop(self): return self._bar def func(self): """Func should not be considered as a settable prop.""" actual = utils.get_settable_properties(SomeClass) self.assertEqual(actual, ['settable_prop'])
self.adb.reboot() def __getattr__(self, name): """Tries to return a snippet client registered with `name`. This is for backward compatibility of direct accessing snippet clients. """ client = self.services.snippets.get_snippet_client(name) if client: return client return self.__getattribute__(name) # Properties in AndroidDevice that have setters. # This line has to live below the AndroidDevice code. _ANDROID_DEVICE_SETTABLE_PROPS = utils.get_settable_properties(AndroidDevice) class AndroidDeviceLoggerAdapter(logging.LoggerAdapter): """A wrapper class that adds a prefix to each log line. Usage: .. code-block:: python my_log = AndroidDeviceLoggerAdapter(logging.getLogger(), { 'tag': <custom tag> }) Then each log line added by my_log will have a prefix '[AndroidDevice|<tag>]'