/breezy-svn/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy-svn/trunk

« back to all changes in this revision

Viewing changes to tests/mapping3/test_scheme.py

  • Committer: Jelmer Vernooij
  • Date: 2018-06-09 08:08:57 UTC
  • Revision ID: jelmer@jelmer.uk-20180609080857-80d0q0isfhsabe2t
Fix some more tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
103
103
        self.assertEqual("none", NoBranchingScheme().__str__())
104
104
 
105
105
    def test_is_branch_empty(self):
106
 
        self.assertTrue(NoBranchingScheme().is_branch(""))
 
106
        self.assertTrue(NoBranchingScheme().is_branch(u""))
107
107
 
108
108
    def test_is_branch_slash(self):
109
 
        self.assertTrue(NoBranchingScheme().is_branch("/"))
 
109
        self.assertTrue(NoBranchingScheme().is_branch(u"/"))
110
110
 
111
111
    def test_is_branch_dir_slash(self):
112
 
        self.assertFalse(NoBranchingScheme().is_branch("/foo"))
 
112
        self.assertFalse(NoBranchingScheme().is_branch(u"/foo"))
113
113
 
114
114
    def test_is_branch_dir_slash_nested(self):
115
 
        self.assertFalse(NoBranchingScheme().is_branch("/foo/foo"))
 
115
        self.assertFalse(NoBranchingScheme().is_branch(u"/foo/foo"))
116
116
 
117
117
    def test_is_branch_dir(self):
118
 
        self.assertFalse(NoBranchingScheme().is_branch("foo/bar"))
 
118
        self.assertFalse(NoBranchingScheme().is_branch(u"foo/bar"))
119
119
 
120
120
    def test_is_branch_dir_doubleslash(self):
121
 
        self.assertFalse(NoBranchingScheme().is_branch("//foo/bar"))
 
121
        self.assertFalse(NoBranchingScheme().is_branch(u"//foo/bar"))
122
122
 
123
123
    def test_is_tag_empty(self):
124
 
        self.assertFalse(NoBranchingScheme().is_tag(""))
 
124
        self.assertFalse(NoBranchingScheme().is_tag(u""))
125
125
 
126
126
    def test_is_tag_slash(self):
127
 
        self.assertFalse(NoBranchingScheme().is_tag("/"))
 
127
        self.assertFalse(NoBranchingScheme().is_tag(u"/"))
128
128
 
129
129
    def test_unprefix(self):
130
 
        self.assertEqual(NoBranchingScheme().unprefix(""), ("", "", ""))
 
130
        self.assertEqual(NoBranchingScheme().unprefix(u""), ("", "", ""))
131
131
 
132
132
    def test_unprefix_slash(self):
133
 
        self.assertEqual(NoBranchingScheme().unprefix("/"), ("", "", ""))
 
133
        self.assertEqual(NoBranchingScheme().unprefix(u"/"), ("", "", ""))
134
134
 
135
135
    def test_unprefix_nested(self):
136
 
        self.assertEqual(NoBranchingScheme().unprefix("foo/foo"), ("", "", "foo/foo"))
 
136
        self.assertEqual(NoBranchingScheme().unprefix(u"foo/foo"), ("", "", "foo/foo"))
137
137
 
138
138
    def test_unprefix_slash_nested(self):
139
 
        self.assertEqual(NoBranchingScheme().unprefix("/foo/foo"), ("", "", "foo/foo"))
 
139
        self.assertEqual(NoBranchingScheme().unprefix(u"/foo/foo"), ("", "", "foo/foo"))
140
140
 
141
141
    def test_is_branch_parent_root(self):
142
 
        self.assertFalse(NoBranchingScheme().is_branch_parent(""))
 
142
        self.assertFalse(NoBranchingScheme().is_branch_parent(u""))
143
143
 
144
144
    def test_is_branch_parent_other(self):
145
 
        self.assertFalse(NoBranchingScheme().is_branch_parent("trunk/foo"))
 
145
        self.assertFalse(NoBranchingScheme().is_branch_parent(u"trunk/foo"))
146
146
 
147
147
    def test_is_tag_parent_root(self):
148
 
        self.assertFalse(NoBranchingScheme().is_tag_parent(""))
 
148
        self.assertFalse(NoBranchingScheme().is_tag_parent(u""))
149
149
 
150
150
    def test_is_tag_parent_other(self):
151
 
        self.assertFalse(NoBranchingScheme().is_tag_parent("trunk/foo"))
 
151
        self.assertFalse(NoBranchingScheme().is_tag_parent(u"trunk/foo"))
152
152
 
153
153
 
154
154
class ListScheme(TestCase):
369
369
        self.assertTrue(scheme.is_branch("/bar/branches/trunk"))
370
370
 
371
371
    def test_unprefix_empty(self):
372
 
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, "")
 
372
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, u"")
373
373
 
374
374
    def test_unprefix_topdir(self):
375
 
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, "branches")
 
375
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, u"branches")
376
376
 
377
377
    def test_unprefix_slash(self):
378
 
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, "/")
 
378
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, u"/")
379
379
 
380
380
    def test_unprefix_unknown_sub(self):
381
 
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, "blie/bloe/bla")
 
381
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, u"blie/bloe/bla")
382
382
 
383
383
    def test_unprefix_unknown(self):
384
 
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, "aa")
 
384
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme().unprefix, u"aa")
385
385
 
386
386
    def test_unprefix_slash_branch(self):
387
 
        self.assertEqual(TrunkBranchingScheme().unprefix("/trunk"), ("", "trunk", ""))
 
387
        self.assertEqual(TrunkBranchingScheme().unprefix(u"/trunk"), ("", "trunk", ""))
388
388
 
389
389
    def test_unprefix_nested_branch_sub(self):
390
 
        self.assertEqual(TrunkBranchingScheme().unprefix("branches/ver1/foo"), ("", "branches/ver1", "foo"))
 
390
        self.assertEqual(TrunkBranchingScheme().unprefix(u"branches/ver1/foo"), ("", "branches/ver1", "foo"))
391
391
 
392
392
    def test_unprefix_nested_tag_sub(self):
393
 
        self.assertEqual(TrunkBranchingScheme().unprefix("tags/ver1"), ("", "tags/ver1", ""))
 
393
        self.assertEqual(TrunkBranchingScheme().unprefix(u"tags/ver1"), ("", "tags/ver1", ""))
394
394
 
395
395
    def test_unprefix_doubleslash_branch(self):
396
 
        self.assertEqual(TrunkBranchingScheme().unprefix("//trunk/foo"), ("", "trunk", "foo"))
 
396
        self.assertEqual(TrunkBranchingScheme().unprefix(u"//trunk/foo"), ("", "trunk", "foo"))
397
397
 
398
398
    def test_unprefix_slash_tag(self):
399
 
        self.assertEqual(TrunkBranchingScheme().unprefix("/tags/ver2/foo/bar"), ("", "tags/ver2", "foo/bar"))
 
399
        self.assertEqual(TrunkBranchingScheme().unprefix(u"/tags/ver2/foo/bar"), ("", "tags/ver2", "foo/bar"))
400
400
 
401
401
    def test_unprefix_level(self):
402
 
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme(1).unprefix, "trunk")
 
402
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme(1).unprefix, u"trunk")
403
403
 
404
404
    def test_unprefix_level_wrong_level(self):
405
 
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme(1).unprefix, "/branches/foo")
 
405
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme(1).unprefix, u"/branches/foo")
406
406
 
407
407
    def test_unprefix_level_wrong_level_nested(self):
408
 
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme(1).unprefix, "branches/ver1/foo")
 
408
        self.assertRaises(InvalidSvnBranchPath, TrunkBranchingScheme(1).unprefix, u"branches/ver1/foo")
409
409
 
410
410
    def test_unprefix_level_correct_branch(self):
411
 
        self.assertEqual(TrunkBranchingScheme(1).unprefix("/foo/trunk"), ("foo", "foo/trunk", ""))
 
411
        self.assertEqual(TrunkBranchingScheme(1).unprefix(u"/foo/trunk"), ("foo", "foo/trunk", ""))
412
412
 
413
413
    def test_unprefix_level_correct_nested(self):
414
 
        self.assertEqual(TrunkBranchingScheme(1).unprefix("data/tags/ver1"), ("data", "data/tags/ver1", ""))
 
414
        self.assertEqual(TrunkBranchingScheme(1).unprefix(u"data/tags/ver1"), ("data", "data/tags/ver1", ""))
415
415
 
416
416
    def test_str0(self):
417
417
        self.assertEqual("trunk0", TrunkBranchingScheme().__str__())
420
420
        self.assertEqual("trunk1", TrunkBranchingScheme(1).__str__())
421
421
        
422
422
    def test_is_branch_parent_root(self):
423
 
        self.assertTrue(TrunkBranchingScheme().is_branch_parent(""))
 
423
        self.assertTrue(TrunkBranchingScheme().is_branch_parent(u""))
424
424
 
425
425
    def test_is_tag_parent_root(self):
426
 
        self.assertFalse(TrunkBranchingScheme().is_tag_parent(""))
 
426
        self.assertFalse(TrunkBranchingScheme().is_tag_parent(u""))
427
427
 
428
428
    def test_is_branch_parent_branches(self):
429
 
        self.assertTrue(TrunkBranchingScheme().is_branch_parent("branches"))
 
429
        self.assertTrue(TrunkBranchingScheme().is_branch_parent(u"branches"))
430
430
 
431
431
    def test_is_tagparent_branches(self):
432
 
        self.assertFalse(TrunkBranchingScheme().is_tag_parent("branches"))
 
432
        self.assertFalse(TrunkBranchingScheme().is_tag_parent(u"branches"))
433
433
 
434
434
    def test_is_tagparent_tags(self):
435
 
        self.assertTrue(TrunkBranchingScheme().is_tag_parent("tags"))
 
435
        self.assertTrue(TrunkBranchingScheme().is_tag_parent(u"tags"))
436
436
 
437
437
    def test_is_branch_parent_tags(self):
438
 
        self.assertFalse(TrunkBranchingScheme().is_branch_parent("tags"))
 
438
        self.assertFalse(TrunkBranchingScheme().is_branch_parent(u"tags"))
439
439
 
440
440
    def test_is_branch_parent_trunk(self):
441
 
        self.assertFalse(TrunkBranchingScheme().is_branch_parent("trunk"))
 
441
        self.assertFalse(TrunkBranchingScheme().is_branch_parent(u"trunk"))
442
442
 
443
443
    def test_is_branch_parent_level(self):
444
 
        self.assertTrue(TrunkBranchingScheme(1).is_branch_parent("anything"))
 
444
        self.assertTrue(TrunkBranchingScheme(1).is_branch_parent(u"anything"))
445
445
 
446
446
    def test_is_tag_parent_level(self):
447
 
        self.assertFalse(TrunkBranchingScheme(1).is_tag_parent("anything"))
 
447
        self.assertFalse(TrunkBranchingScheme(1).is_tag_parent(u"anything"))
448
448
 
449
449
    def test_is_branch_parent_level_root(self):
450
 
        self.assertTrue(TrunkBranchingScheme(1).is_branch_parent(""))
 
450
        self.assertTrue(TrunkBranchingScheme(1).is_branch_parent(u""))
451
451
 
452
452
    def test_is_branch_parent_level_strange(self):
453
 
        self.assertFalse(TrunkBranchingScheme(1).is_branch_parent("trunk/foo"))
 
453
        self.assertFalse(TrunkBranchingScheme(1).is_branch_parent(u"trunk/foo"))
454
454
 
455
455
    def test_is_branch_parent_level_inside(self):
456
 
        self.assertFalse(TrunkBranchingScheme(1).is_branch_parent("foo/trunk/foo"))
 
456
        self.assertFalse(TrunkBranchingScheme(1).is_branch_parent(u"foo/trunk/foo"))
457
457
 
458
458
    def test_is_branch_parent_level_branches(self):
459
 
        self.assertTrue(TrunkBranchingScheme(1).is_branch_parent("anything/branches"))
 
459
        self.assertTrue(TrunkBranchingScheme(1).is_branch_parent(u"anything/branches"))
460
460
 
461
461
    def test_is_tag_parent_level_tags(self):
462
 
        self.assertTrue(TrunkBranchingScheme(1).is_tag_parent("anything/tags"))
 
462
        self.assertTrue(TrunkBranchingScheme(1).is_tag_parent(u"anything/tags"))
463
463
 
464
464
    def test_is_branch_parent_other(self):
465
 
        self.assertFalse(TrunkBranchingScheme().is_branch_parent("trunk/foo"))
 
465
        self.assertFalse(TrunkBranchingScheme().is_branch_parent(u"trunk/foo"))
466
466
 
467
467
    def test_get_tag_path_zero(self):
468
468
        self.assertEquals("tags/foo", 
470
470
 
471
471
    def test_get_tag_path_nonzero(self):
472
472
        self.assertEquals("my/project/tags/foo",
473
 
                          TrunkBranchingScheme(2).get_tag_path(u"foo", "my/project"))
 
473
                          TrunkBranchingScheme(2).get_tag_path(u"foo", u"my/project"))
474
474
 
475
475
    def test_get_branch_path_zero(self):
476
476
        self.assertEquals("branches/foo", 
477
 
                          TrunkBranchingScheme().get_branch_path("foo"))
 
477
                          TrunkBranchingScheme().get_branch_path(u"foo"))
478
478
 
479
479
    def test_get_branch_path_zero_trunk(self):
480
480
        self.assertEquals("trunk", 
481
 
                          TrunkBranchingScheme().get_branch_path("trunk"))
 
481
                          TrunkBranchingScheme().get_branch_path(u"trunk"))
482
482
 
483
483
    def test_get_branch_path_nonzero(self):
484
484
        self.assertEquals("my/project/branches/foo",
485
 
                          TrunkBranchingScheme(2).get_branch_path("foo", "my/project"))
 
485
                          TrunkBranchingScheme(2).get_branch_path(u"foo", u"my/project"))
486
486
 
487
487
 
488
488
class SingleBranchingSchemeTests(TestCase):