~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_xml.py

  • Committer: Aaron Bentley
  • Date: 2008-03-28 03:09:47 UTC
  • mto: This revision was merged to the branch mainline in revision 3371.
  • Revision ID: aaron@aaronbentley.com-20080328030947-57cfqi7to7k401wc
Have xml5 inherit from xml6 from xml8

Show diffs side-by-side

added added

removed removed

Lines of Context:
511
511
 
512
512
    def setUp(self):
513
513
        # Keep the cache clear before and after the test
514
 
        bzrlib.xml5._ensure_utf8_re()
515
 
        bzrlib.xml5._clear_cache()
516
 
        self.addCleanup(bzrlib.xml5._clear_cache)
 
514
        bzrlib.xml8._ensure_utf8_re()
 
515
        bzrlib.xml8._clear_cache()
 
516
        self.addCleanup(bzrlib.xml8._clear_cache)
517
517
 
518
518
    def test_simple_ascii(self):
519
519
        # _encode_and_escape always appends a final ", because these parameters
520
520
        # are being used in xml attributes, and by returning it now, we have to
521
521
        # do fewer string operations later.
522
 
        val = bzrlib.xml5._encode_and_escape('foo bar')
 
522
        val = bzrlib.xml8._encode_and_escape('foo bar')
523
523
        self.assertEqual('foo bar"', val)
524
524
        # The second time should be cached
525
 
        val2 = bzrlib.xml5._encode_and_escape('foo bar')
 
525
        val2 = bzrlib.xml8._encode_and_escape('foo bar')
526
526
        self.assertIs(val2, val)
527
527
 
528
528
    def test_ascii_with_xml(self):
529
529
        self.assertEqual('&'"<>"',
530
 
                         bzrlib.xml5._encode_and_escape('&\'"<>'))
 
530
                         bzrlib.xml8._encode_and_escape('&\'"<>'))
531
531
 
532
532
    def test_utf8_with_xml(self):
533
533
        # u'\xb5\xe5&\u062c'
534
534
        utf8_str = '\xc2\xb5\xc3\xa5&\xd8\xac'
535
535
        self.assertEqual('&#181;&#229;&amp;&#1580;"',
536
 
                         bzrlib.xml5._encode_and_escape(utf8_str))
 
536
                         bzrlib.xml8._encode_and_escape(utf8_str))
537
537
 
538
538
    def test_unicode(self):
539
539
        uni_str = u'\xb5\xe5&\u062c'
540
540
        self.assertEqual('&#181;&#229;&amp;&#1580;"',
541
 
                         bzrlib.xml5._encode_and_escape(uni_str))
 
541
                         bzrlib.xml8._encode_and_escape(uni_str))