File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ def get_from(obj):
7171 pin_name = _DD_PIN_PROXY_NAME if isinstance (obj , wrapt .ObjectProxy ) else _DD_PIN_NAME
7272 pin = getattr (obj , pin_name , None )
7373 # detect if the PIN has been inherited from a class
74- if pin is not None and pin ._target is not obj :
74+ if pin is not None and pin ._target != id ( obj ) :
7575 pin = pin .clone ()
7676 pin .onto (obj )
7777 return pin
Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ def test_configuration_get_from(self):
2424 cfg = config .get_from (self .Klass )
2525 ok_ (isinstance (cfg , dict ))
2626
27+ def test_configuration_get_from_twice (self ):
28+ # ensure the configuration is the same if `get_from` is used
29+ # in the same instance
30+ instance = self .Klass ()
31+ cfg1 = config .get_from (instance )
32+ cfg2 = config .get_from (instance )
33+ ok_ (cfg1 is cfg2 )
34+
2735 def test_configuration_set (self ):
2836 # ensure the configuration can be updated in the Pin
2937 instance = self .Klass ()
You can’t perform that action at this time.
0 commit comments