MCPcopy Create free account
hub / github.com/ActiveState/code / Test

Class Test

recipes/Python/577482_Easy_property/recipe-577482.py:295–309  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293 ####
294
295 class Test( object ):
296 ro_value = Property( 'ro_value', 'test', mode = Property.Mode.READ_ONLY )
297
298 assertException( ValueError, lambda: Property( 'ro_undef', mode = Property.Mode.READ_ONLY ),
299 'read-only attributes should require default' )
300
301 rw_undef = Property( 'rw_undef' )
302 rw_default = Property( 'rw_default', None )
303 rw_doc = Property( 'rw_default', doc = 'alternate documentation' )
304
305 assertException( TypeError, lambda: Property( 'bad_mode', mode = None ),
306 'bad Property mode should raise an exception' )
307
308 wo_undef = Property( 'wo_undef', mode = Property.Mode.WRITE_ONCE )
309 wo_default = Property( 'wo_default', 'test', mode = Property.Mode.WRITE_ONCE )
310
311 a = Test()
312 b = Test()

Callers 1

recipe-577482.pyFile · 0.70

Calls 2

PropertyClass · 0.70
assertExceptionFunction · 0.70

Tested by

no test coverage detected