File: skip-conditional.txt

package info (click to toggle)
python-sybil 9.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,148 kB
  • sloc: python: 4,510; makefile: 90
file content (26 lines) | stat: -rw-r--r-- 487 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
>>> result.append('start')

Default reason:

.. skip: next if(2 > 1)

Should not run:

>>> result.append('bad 1')
>>> result.append('good 1')

.. skip: start if(2 > 1, reason='foo')

>>> result.append('bad 2')
>>> result.append('bad 3')

.. skip: end

>>> result.append('good 2')


Here's a really extreme example of computing the reason from stuff in the namespace:

.. skip:  next   if    (True, 'good reason' if result[-1] == 'good 2' else 'bad reason'  )

>>> result.append('bad 4')