103
103
'a test message\n')
106
class TestUnicodeFilename(TestCase):
108
def test_probe_passes(self):
109
"""UnicodeFilename._probe passes."""
110
# We can't test much more than that because the behaviour depends
112
tests.UnicodeFilename._probe()
106
115
class TestTreeShape(TestCaseInTempDir):
108
117
def test_unicode_paths(self):
118
self.requireFeature(tests.UnicodeFilename)
109
120
filename = u'hell\u00d8'
111
self.build_tree_contents([(filename, 'contents of hello')])
112
except UnicodeEncodeError:
113
raise TestSkipped("can't build unicode working tree in "
114
"filesystem encoding %s" % sys.getfilesystemencoding())
121
self.build_tree_contents([(filename, 'contents of hello')])
115
122
self.failUnlessExists(filename)
1458
def test_assert_list_raises_on_generator(self):
1459
def generator_which_will_raise():
1460
# This will not raise until after the first yield
1462
raise _TestException()
1464
e = self.assertListRaises(_TestException, generator_which_will_raise)
1465
self.assertIsInstance(e, _TestException)
1467
e = self.assertListRaises(Exception, generator_which_will_raise)
1468
self.assertIsInstance(e, _TestException)
1470
def test_assert_list_raises_on_plain(self):
1471
def plain_exception():
1472
raise _TestException()
1475
e = self.assertListRaises(_TestException, plain_exception)
1476
self.assertIsInstance(e, _TestException)
1478
e = self.assertListRaises(Exception, plain_exception)
1479
self.assertIsInstance(e, _TestException)
1481
def test_assert_list_raises_assert_wrong_exception(self):
1482
class _NotTestException(Exception):
1485
def wrong_exception():
1486
raise _NotTestException()
1488
def wrong_exception_generator():
1491
raise _NotTestException()
1493
# Wrong exceptions are not intercepted
1494
self.assertRaises(_NotTestException,
1495
self.assertListRaises, _TestException, wrong_exception)
1496
self.assertRaises(_NotTestException,
1497
self.assertListRaises, _TestException, wrong_exception_generator)
1499
def test_assert_list_raises_no_exception(self):
1503
def success_generator():
1507
self.assertRaises(AssertionError,
1508
self.assertListRaises, _TestException, success)
1510
self.assertRaises(AssertionError,
1511
self.assertListRaises, _TestException, success_generator)
1450
1514
@symbol_versioning.deprecated_function(zero_eleven)
1451
1515
def sample_deprecated_function():