Mercurial > hg
comparison tests/test-walkrepo.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | fa2423acb02f |
children | 6000f5b25c9b |
comparison
equal
deleted
inserted
replaced
43075:57875cf423c9 | 43076:2372284d9457 |
---|---|
29 chdir(os.path.pardir) | 29 chdir(os.path.pardir) |
30 if sym: | 30 if sym: |
31 os.symlink(os.path.pardir, b'circle') | 31 os.symlink(os.path.pardir, b'circle') |
32 os.symlink(pjoin(b'subsubdir', b'subsub1'), b'subsub1') | 32 os.symlink(pjoin(b'subsubdir', b'subsub1'), b'subsub1') |
33 | 33 |
34 | |
34 def runtest(): | 35 def runtest(): |
35 reposet = frozenset(walkrepos(b'.', followsym=True)) | 36 reposet = frozenset(walkrepos(b'.', followsym=True)) |
36 if sym and (len(reposet) != 3): | 37 if sym and (len(reposet) != 3): |
37 print("reposet = %r" % (reposet,)) | 38 print("reposet = %r" % (reposet,)) |
38 print(("Found %d repositories when I should have found 3" | 39 print( |
39 % (len(reposet),))) | 40 ( |
41 "Found %d repositories when I should have found 3" | |
42 % (len(reposet),) | |
43 ) | |
44 ) | |
40 if (not sym) and (len(reposet) != 2): | 45 if (not sym) and (len(reposet) != 2): |
41 print("reposet = %r" % (reposet,)) | 46 print("reposet = %r" % (reposet,)) |
42 print(("Found %d repositories when I should have found 2" | 47 print( |
43 % (len(reposet),))) | 48 ( |
44 sub1set = frozenset((pjoin(b'.', b'sub1'), | 49 "Found %d repositories when I should have found 2" |
45 pjoin(b'.', b'circle', b'subdir', b'sub1'))) | 50 % (len(reposet),) |
51 ) | |
52 ) | |
53 sub1set = frozenset( | |
54 (pjoin(b'.', b'sub1'), pjoin(b'.', b'circle', b'subdir', b'sub1')) | |
55 ) | |
46 if len(sub1set & reposet) != 1: | 56 if len(sub1set & reposet) != 1: |
47 print("sub1set = %r" % (sub1set,)) | 57 print("sub1set = %r" % (sub1set,)) |
48 print("reposet = %r" % (reposet,)) | 58 print("reposet = %r" % (reposet,)) |
49 print("sub1set and reposet should have exactly one path in common.") | 59 print("sub1set and reposet should have exactly one path in common.") |
50 sub2set = frozenset((pjoin(b'.', b'subsub1'), | 60 sub2set = frozenset( |
51 pjoin(b'.', b'subsubdir', b'subsub1'))) | 61 (pjoin(b'.', b'subsub1'), pjoin(b'.', b'subsubdir', b'subsub1')) |
62 ) | |
52 if len(sub2set & reposet) != 1: | 63 if len(sub2set & reposet) != 1: |
53 print("sub2set = %r" % (sub2set,)) | 64 print("sub2set = %r" % (sub2set,)) |
54 print("reposet = %r" % (reposet,)) | 65 print("reposet = %r" % (reposet,)) |
55 print("sub2set and reposet should have exactly one path in common.") | 66 print("sub2set and reposet should have exactly one path in common.") |
56 sub3 = pjoin(b'.', b'circle', b'top1') | 67 sub3 = pjoin(b'.', b'circle', b'top1') |
57 if sym and sub3 not in reposet: | 68 if sym and sub3 not in reposet: |
58 print("reposet = %r" % (reposet,)) | 69 print("reposet = %r" % (reposet,)) |
59 print("Symbolic links are supported and %s is not in reposet" % (sub3,)) | 70 print("Symbolic links are supported and %s is not in reposet" % (sub3,)) |
60 | 71 |
72 | |
61 runtest() | 73 runtest() |
62 if sym: | 74 if sym: |
63 # Simulate not having symlinks. | 75 # Simulate not having symlinks. |
64 del os.path.samestat | 76 del os.path.samestat |
65 sym = False | 77 sym = False |