# HG changeset patch # User Paul Boddie # Date 1304872881 -7200 # Node ID 57ac9550cc0b06a2d017345f89dd9da7ac2dfa4a # Parent e78c27763673b1cdc910030ff028eb33b18ebaf8 Added a test which demonstrates the need for speculative attribute coverage when getattr is involved. diff -r e78c27763673 -r 57ac9550cc0b TO_DO.txt --- a/TO_DO.txt Sun May 01 00:37:51 2011 +0200 +++ b/TO_DO.txt Sun May 08 18:41:21 2011 +0200 @@ -1,3 +1,11 @@ +Dynamic Attribute Access +======================== + +Ensure that getattr (or other dynamic attribute usage) causes propagation of coverage to +the potential attributes. + +Consider explicit accessor initialisation. + Attribute Usage =============== diff -r e78c27763673 -r 57ac9550cc0b tests/getattr_instance_methods.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/getattr_instance_methods.py Sun May 08 18:41:21 2011 +0200 @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +class C: + def x(self): + return 1 + +class D: + def x(self): + return 2 + +c = C() +d = D() +result_1 = getattr(c, "x")() +result_2 = getattr(d, "x")() + +# vim: tabstop=4 expandtab shiftwidth=4