Mercurial > hg
annotate tests/test-byteify-strings.t @ 52148:1dbbb957bbe6 stable
run-tests: add a --hg-wheel options to test a pre-built wheel
This will be useful to test the wheel we intend to publish.
A future changeset will integrate this in the CI.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 27 Oct 2024 08:54:48 +0100 |
parents | 8250ecb53f30 |
children |
rev | line source |
---|---|
43407
09234eeae206
contrib: require Python 3.7 for byteify-strings.py
Ian Moody <moz-ian@perix.co.uk>
parents:
43379
diff
changeset
|
1 #require py37 |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
2 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
3 $ byteify_strings () { |
43493
3a463e5e470b
tests: quote $PYTHON in test-byteify-strings.t
Matt Harbison <matt_harbison@yahoo.com>
parents:
43407
diff
changeset
|
4 > "$PYTHON" "$TESTDIR/../contrib/byteify-strings.py" "$@" |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
5 > } |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
6 |
42701
11498aa91c03
byteify-strings: add --version argument
Raphaël Gomès <rgomes@octobus.net>
parents:
42700
diff
changeset
|
7 Test version |
11498aa91c03
byteify-strings: add --version argument
Raphaël Gomès <rgomes@octobus.net>
parents:
42700
diff
changeset
|
8 |
11498aa91c03
byteify-strings: add --version argument
Raphaël Gomès <rgomes@octobus.net>
parents:
42700
diff
changeset
|
9 $ byteify_strings --version |
11498aa91c03
byteify-strings: add --version argument
Raphaël Gomès <rgomes@octobus.net>
parents:
42700
diff
changeset
|
10 Byteify strings * (glob) |
11498aa91c03
byteify-strings: add --version argument
Raphaël Gomès <rgomes@octobus.net>
parents:
42700
diff
changeset
|
11 |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
12 Test in-place |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
13 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
14 $ cat > testfile.py <<EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
15 > obj['test'] = b"1234" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
16 > mydict.iteritems() |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
17 > EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
18 $ byteify_strings testfile.py -i |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
19 $ cat testfile.py |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
20 obj[b'test'] = b"1234" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
21 mydict.iteritems() |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
22 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
23 Test with dictiter |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
24 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
25 $ cat > testfile.py <<EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
26 > obj['test'] = b"1234" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
27 > mydict.iteritems() |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
28 > EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
29 $ byteify_strings testfile.py --dictiter |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
30 obj[b'test'] = b"1234" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
31 mydict.items() |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
32 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
33 Test kwargs-like objects |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
34 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
35 $ cat > testfile.py <<EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
36 > kwargs['test'] = "123" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
37 > kwargs[test['testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
38 > kwargs[test[[['testing']]]] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
39 > kwargs[kwargs['testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
40 > kwargs.get('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
41 > kwargs.pop('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
42 > kwargs.get('test', 'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
43 > kwargs.pop('test', 'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
44 > kwargs.setdefault('test', 'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
45 > |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
46 > opts['test'] = "123" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
47 > opts[test['testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
48 > opts[test[[['testing']]]] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
49 > opts[opts['testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
50 > opts.get('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
51 > opts.pop('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
52 > opts.get('test', 'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
53 > opts.pop('test', 'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
54 > opts.setdefault('test', 'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
55 > |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
56 > commitopts['test'] = "123" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
57 > commitopts[test['testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
58 > commitopts[test[[['testing']]]] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
59 > commitopts[commitopts['testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
60 > commitopts.get('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
61 > commitopts.pop('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
62 > commitopts.get('test', 'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
63 > commitopts.pop('test', 'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
64 > commitopts.setdefault('test', 'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
65 > EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
66 $ byteify_strings testfile.py --treat-as-kwargs kwargs opts commitopts |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
67 kwargs['test'] = b"123" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
68 kwargs[test[b'testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
69 kwargs[test[[[b'testing']]]] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
70 kwargs[kwargs['testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
71 kwargs.get('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
72 kwargs.pop('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
73 kwargs.get('test', b'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
74 kwargs.pop('test', b'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
75 kwargs.setdefault('test', b'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
76 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
77 opts['test'] = b"123" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
78 opts[test[b'testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
79 opts[test[[[b'testing']]]] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
80 opts[opts['testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
81 opts.get('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
82 opts.pop('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
83 opts.get('test', b'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
84 opts.pop('test', b'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
85 opts.setdefault('test', b'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
86 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
87 commitopts['test'] = b"123" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
88 commitopts[test[b'testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
89 commitopts[test[[[b'testing']]]] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
90 commitopts[commitopts['testing']] |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
91 commitopts.get('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
92 commitopts.pop('test') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
93 commitopts.get('test', b'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
94 commitopts.pop('test', b'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
95 commitopts.setdefault('test', b'testing') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
96 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
97 Test attr*() as methods |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
98 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
99 $ cat > testfile.py <<EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
100 > setattr(o, 'a', 1) |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
101 > util.setattr(o, 'ae', 1) |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
102 > util.getattr(o, 'alksjdf', 'default') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
103 > util.addattr(o, 'asdf') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
104 > util.hasattr(o, 'lksjdf', 'default') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
105 > util.safehasattr(o, 'lksjdf', 'default') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
106 > @eh.wrapfunction(func, 'lksjdf') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
107 > def f(): |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
108 > pass |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
109 > @eh.wrapclass(klass, 'lksjdf') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
110 > def f(): |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
111 > pass |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
112 > EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
113 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
114 Test without attr*() as methods |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
115 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
116 $ cat > testfile.py <<EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
117 > setattr(o, 'a', 1) |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
118 > util.setattr(o, 'ae', 1) |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
119 > util.getattr(o, 'alksjdf', 'default') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
120 > util.addattr(o, 'asdf') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
121 > util.hasattr(o, 'lksjdf', 'default') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
122 > util.safehasattr(o, 'lksjdf', 'default') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
123 > @eh.wrapfunction(func, 'lksjdf') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
124 > def f(): |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
125 > pass |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
126 > @eh.wrapclass(klass, 'lksjdf') |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
127 > def f(): |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
128 > pass |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
129 > EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
130 $ byteify_strings testfile.py |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
131 setattr(o, 'a', 1) |
50773
8250ecb53f30
byteify-strings: passe sysstr to attr function and wrapper
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43493
diff
changeset
|
132 util.setattr(o, 'ae', 1) |
8250ecb53f30
byteify-strings: passe sysstr to attr function and wrapper
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43493
diff
changeset
|
133 util.getattr(o, 'alksjdf', b'default') |
8250ecb53f30
byteify-strings: passe sysstr to attr function and wrapper
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43493
diff
changeset
|
134 util.addattr(o, 'asdf') |
8250ecb53f30
byteify-strings: passe sysstr to attr function and wrapper
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43493
diff
changeset
|
135 util.hasattr(o, 'lksjdf', b'default') |
8250ecb53f30
byteify-strings: passe sysstr to attr function and wrapper
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43493
diff
changeset
|
136 util.safehasattr(o, 'lksjdf', b'default') |
8250ecb53f30
byteify-strings: passe sysstr to attr function and wrapper
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43493
diff
changeset
|
137 @eh.wrapfunction(func, 'lksjdf') |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
138 def f(): |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
139 pass |
50773
8250ecb53f30
byteify-strings: passe sysstr to attr function and wrapper
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
43493
diff
changeset
|
140 @eh.wrapclass(klass, 'lksjdf') |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
141 def f(): |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
142 pass |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
143 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
144 Test ignore comments |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
145 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
146 $ cat > testfile.py <<EOF |
42700
f9b64ff9d26b
byteify-strings: add space in special comments to silence flake8 error
Raphaël Gomès <rgomes@octobus.net>
parents:
42687
diff
changeset
|
147 > # py3-transform: off |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
148 > "none" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
149 > "of" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
150 > 'these' |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
151 > s = """should""" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
152 > d = '''be''' |
42700
f9b64ff9d26b
byteify-strings: add space in special comments to silence flake8 error
Raphaël Gomès <rgomes@octobus.net>
parents:
42687
diff
changeset
|
153 > # py3-transform: on |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
154 > "this should" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
155 > 'and this also' |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
156 > |
42700
f9b64ff9d26b
byteify-strings: add space in special comments to silence flake8 error
Raphaël Gomès <rgomes@octobus.net>
parents:
42687
diff
changeset
|
157 > # no-py3-transform |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
158 > l = "this should be ignored" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
159 > l2 = "this shouldn't" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
160 > |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
161 > EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
162 $ byteify_strings testfile.py |
42700
f9b64ff9d26b
byteify-strings: add space in special comments to silence flake8 error
Raphaël Gomès <rgomes@octobus.net>
parents:
42687
diff
changeset
|
163 # py3-transform: off |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
164 "none" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
165 "of" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
166 'these' |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
167 s = """should""" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
168 d = '''be''' |
42700
f9b64ff9d26b
byteify-strings: add space in special comments to silence flake8 error
Raphaël Gomès <rgomes@octobus.net>
parents:
42687
diff
changeset
|
169 # py3-transform: on |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
170 b"this should" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
171 b'and this also' |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
172 |
42700
f9b64ff9d26b
byteify-strings: add space in special comments to silence flake8 error
Raphaël Gomès <rgomes@octobus.net>
parents:
42687
diff
changeset
|
173 # no-py3-transform |
42686
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
174 l = "this should be ignored" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
175 l2 = b"this shouldn't" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
176 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
177 Test triple-quoted strings |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
178 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
179 $ cat > testfile.py <<EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
180 > """This is ignored |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
181 > """ |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
182 > |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
183 > line = """ |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
184 > This should not be |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
185 > """ |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
186 > line = ''' |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
187 > Neither should this |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
188 > ''' |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
189 > EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
190 $ byteify_strings testfile.py |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
191 """This is ignored |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
192 """ |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
193 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
194 line = b""" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
195 This should not be |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
196 """ |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
197 line = b''' |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
198 Neither should this |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
199 ''' |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
200 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
201 Test prefixed strings |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
202 |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
203 $ cat > testfile.py <<EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
204 > obj['test'] = b"1234" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
205 > obj[r'test'] = u"1234" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
206 > EOF |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
207 $ byteify_strings testfile.py |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
208 obj[b'test'] = b"1234" |
3364b4da5271
byteify-strings: add test for byteify-strings.py
Raphaël Gomès <rgomes@octobus.net>
parents:
diff
changeset
|
209 obj[r'test'] = u"1234" |
42687
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
210 |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
211 Test multi-line alignment |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
212 |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
213 $ cat > testfile.py <<'EOF' |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
214 > def foo(): |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
215 > error.Abort(_("foo" |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
216 > "bar" |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
217 > "%s") |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
218 > % parameter) |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
219 > { |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
220 > 'test': dict, |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
221 > 'test2': dict, |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
222 > } |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
223 > [ |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
224 > "thing", |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
225 > "thing2" |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
226 > ] |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
227 > ( |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
228 > "tuple", |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
229 > "tuple2", |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
230 > ) |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
231 > {"thing", |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
232 > } |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
233 > EOF |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
234 $ byteify_strings testfile.py |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
235 def foo(): |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
236 error.Abort(_(b"foo" |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
237 b"bar" |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
238 b"%s") |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
239 % parameter) |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
240 { |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
241 b'test': dict, |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
242 b'test2': dict, |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
243 } |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
244 [ |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
245 b"thing", |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
246 b"thing2" |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
247 ] |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
248 ( |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
249 b"tuple", |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
250 b"tuple2", |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
251 ) |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
252 {b"thing", |
26a31c88e1a5
byteify-strings: fix misalignment with multi-line parenthesis
Raphaël Gomès <rgomes@octobus.net>
parents:
42686
diff
changeset
|
253 } |