Exemplo n.º 1
0
 def test_split_reserved_name(self):
     expectations = {
         rh.RESERVED: ('', ),
         rh.RESERVED + 'foo': ('foo', ),
         rh.RESERVED + 'foo' + rh.RESERVED + 'bar': ('foo', 'bar'),
         rh.RESERVED + 'foo' + rh.RESERVED: ('foo', ''),
         rh.RESERVED * 2: ('', ''),
     }
     failures = []
     for name, expected in expectations.items():
         parts = rh.split_reserved_name(name)
         if tuple(parts) != expected:
             failures.append('split given %r expected %r != %r' %
                             (name, expected, parts))
     if failures:
         self.fail('Unexpected reults:\n' + '\n'.join(failures))
Exemplo n.º 2
0
 def test_invalid_split_reserved_name(self):
     self.assertRaises(ValueError)
     with self.assertRaises(ValueError) as ctx:
         rh.split_reserved_name('foo')
     self.assertEqual(str(ctx.exception), 'Invalid reserved name')