~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_xml.py

  • Committer: Martin Packman
  • Date: 2011-11-23 18:59:43 UTC
  • mto: This revision was merged to the branch mainline in revision 6304.
  • Revision ID: martin.packman@canonical.com-20111123185943-1s2ltxqt5ugohh0w
Add full stops to various registry help strings

Show diffs side-by-side

added added

removed removed

Lines of Context:
414
414
        self.assertEqual('tree-root-321', inv2['nested-id'].parent_id)
415
415
        self.assertEqual('rev-outer', inv2['nested-id'].revision)
416
416
        self.assertEqual('rev-inner', inv2['nested-id'].reference_revision)
 
417
        self.assertRaises(errors.UnsupportedInventoryKind,
 
418
                          s_v6.read_inventory_from_string,
 
419
                          txt.replace('format="7"', 'format="6"'))
 
420
        self.assertRaises(errors.UnsupportedInventoryKind,
 
421
                          s_v5.read_inventory_from_string,
 
422
                          txt.replace('format="7"', 'format="5"'))
417
423
 
418
424
    def test_roundtrip_inventory_v8(self):
419
425
        inv = self.get_sample_inventory()
502
508
    def setUp(self):
503
509
        TestCase.setUp(self)
504
510
        # Keep the cache clear before and after the test
505
 
        bzrlib.xml_serializer._clear_cache()
506
 
        self.addCleanup(bzrlib.xml_serializer._clear_cache)
 
511
        bzrlib.xml8._ensure_utf8_re()
 
512
        bzrlib.xml8._clear_cache()
 
513
        self.addCleanup(bzrlib.xml8._clear_cache)
507
514
 
508
515
    def test_simple_ascii(self):
509
516
        # _encode_and_escape always appends a final ", because these parameters
510
517
        # are being used in xml attributes, and by returning it now, we have to
511
518
        # do fewer string operations later.
512
 
        val = bzrlib.xml_serializer.encode_and_escape('foo bar')
 
519
        val = bzrlib.xml8._encode_and_escape('foo bar')
513
520
        self.assertEqual('foo bar"', val)
514
521
        # The second time should be cached
515
 
        val2 = bzrlib.xml_serializer.encode_and_escape('foo bar')
 
522
        val2 = bzrlib.xml8._encode_and_escape('foo bar')
516
523
        self.assertIs(val2, val)
517
524
 
518
525
    def test_ascii_with_xml(self):
519
526
        self.assertEqual('&'"<>"',
520
 
                         bzrlib.xml_serializer.encode_and_escape('&\'"<>'))
 
527
                         bzrlib.xml8._encode_and_escape('&\'"<>'))
521
528
 
522
529
    def test_utf8_with_xml(self):
523
530
        # u'\xb5\xe5&\u062c'
524
531
        utf8_str = '\xc2\xb5\xc3\xa5&\xd8\xac'
525
532
        self.assertEqual('&#181;&#229;&amp;&#1580;"',
526
 
                         bzrlib.xml_serializer.encode_and_escape(utf8_str))
 
533
                         bzrlib.xml8._encode_and_escape(utf8_str))
527
534
 
528
535
    def test_unicode(self):
529
536
        uni_str = u'\xb5\xe5&\u062c'
530
537
        self.assertEqual('&#181;&#229;&amp;&#1580;"',
531
 
                         bzrlib.xml_serializer.encode_and_escape(uni_str))
 
538
                         bzrlib.xml8._encode_and_escape(uni_str))
532
539
 
533
540
 
534
541
class TestMisc(TestCase):