/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_urlutils.py

  • Committer: Marius Kruger
  • Date: 2007-08-12 08:15:15 UTC
  • mfrom: (2695 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2979.
  • Revision ID: amanic@gmail.com-20070812081515-vgekipfhohcuj6rn
merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
115
115
        eq('http://host/ab/%C2%B5/%C2%B5',
116
116
            normalize_url(u'http://host/ab/%C2%B5/\xb5'))
117
117
 
 
118
        # Unescape characters that don't need to be escaped
 
119
        eq('http://host/~bob%2525-._',
 
120
                normalize_url('http://host/%7Ebob%2525%2D%2E%5F'))
 
121
        eq('http://host/~bob%2525-._',
 
122
                normalize_url(u'http://host/%7Ebob%2525%2D%2E%5F'))
 
123
 
118
124
        # Normalize verifies URLs when they are not unicode
119
125
        # (indicating they did not come from the user)
120
126
        self.assertRaises(InvalidURL, normalize_url, 'http://host/\xb5')
564
570
        #   u'/dod\xe9' => '/dod\xc3\xa9'
565
571
        url = urlutils.local_path_to_url('.')
566
572
        self.assertEndsWith(url, '/dod%C3%A9')
 
573
 
 
574
 
 
575
class TestDeriveToLocation(TestCase):
 
576
    """Test that the mapping of FROM_LOCATION to TO_LOCATION works."""
 
577
 
 
578
    def test_to_locations_derived_from_paths(self):
 
579
        derive = urlutils.derive_to_location
 
580
        self.assertEqual("bar", derive("bar"))
 
581
        self.assertEqual("bar", derive("../bar"))
 
582
        self.assertEqual("bar", derive("/foo/bar"))
 
583
        self.assertEqual("bar", derive("c:/foo/bar"))
 
584
        self.assertEqual("bar", derive("c:bar"))
 
585
 
 
586
    def test_to_locations_derived_from_urls(self):
 
587
        derive = urlutils.derive_to_location
 
588
        self.assertEqual("bar", derive("http://foo/bar"))
 
589
        self.assertEqual("bar", derive("bzr+ssh://foo/bar"))
 
590
        self.assertEqual("foo-bar", derive("lp:foo-bar"))