/usr/lib/python2.7/dist-packages/traits/adaptation/tests/test_adaptation_offer.py is in python-traits 4.6.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | """ Test the adaptation offers. """
import sys
from traits.adaptation.adaptation_offer import AdaptationOffer
from traits.testing.unittest_tools import unittest
class TestAdaptationOffer(unittest.TestCase):
""" Test the adaptation offers. """
def test_lazy_loading(self):
LAZY_EXAMPLES = 'traits.adaptation.tests.lazy_examples'
if LAZY_EXAMPLES in sys.modules:
del sys.modules[LAZY_EXAMPLES]
offer = AdaptationOffer(
factory =(LAZY_EXAMPLES + '.IBarToIFoo'),
from_protocol =(LAZY_EXAMPLES + '.IBar'),
to_protocol =(LAZY_EXAMPLES + '.IFoo'),
)
self.assertNotIn(LAZY_EXAMPLES, sys.modules)
factory = offer.factory
self.assertIn(LAZY_EXAMPLES, sys.modules)
from traits.adaptation.tests.lazy_examples import IBarToIFoo
self.assertIs(factory, IBarToIFoo)
del sys.modules[LAZY_EXAMPLES]
from_protocol = offer.from_protocol
from traits.adaptation.tests.lazy_examples import IBar
self.assertIs(from_protocol, IBar)
del sys.modules[LAZY_EXAMPLES]
to_protocol = offer.to_protocol
from traits.adaptation.tests.lazy_examples import IFoo
self.assertIs(to_protocol, IFoo)
if __name__ == '__main__':
unittest.main()
#### EOF ######################################################################
|