Changeset 7939
- Timestamp:
- 22 Mar 2012, 01:46:59 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_helpers.py
r7811 r7939 25 25 import doctest 26 26 from cStringIO import StringIO 27 from zope import schema 27 28 from zope.security.testing import Principal, Participation 28 29 from zope.security.management import newInteraction, endInteraction … … 238 239 self.assertEqual( 239 240 helpers.file_size(StringIO('my sample content')), 17) 241 242 class IfaceNamesTestCase(unittest.TestCase): 243 244 def test_iface_names(self): 245 from zope.interface import Interface, Attribute 246 class I1(Interface): 247 foo = Attribute("""Some Foo""") 248 def bar(blah): 249 pass 250 i1_name = schema.TextLine(title=u'i1 name') 251 class I2(I1): 252 baz = schema.TextLine(title=u'some baz') 253 254 result1 = helpers.iface_names(I2) 255 result2 = helpers.iface_names(I1) 256 result3 = helpers.iface_names(I2, exclude_attribs=False) 257 result4 = helpers.iface_names(I2, exclude_methods=False) 258 result5 = helpers.iface_names(I2, omit='i1_name') 259 self.assertEqual(sorted(result1), ['baz', 'i1_name']) 260 self.assertEqual(sorted(result2), ['i1_name']) 261 self.assertEqual(sorted(result3), ['baz', 'foo', 'i1_name']) 262 self.assertEqual(sorted(result4), ['bar', 'baz', 'i1_name']) 263 self.assertEqual(sorted(result5), ['baz']) 264 return 240 265 241 266 def test_suite(): … … 250 275 CmpFilesTestCase, 251 276 FileSizeTestCase, 277 IfaceNamesTestCase, 252 278 ]: 253 279 suite.addTests(
Note: See TracChangeset for help on using the changeset viewer.