File: test70.py

package info (click to toggle)
pychecker 0.8.10-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,276 kB
  • ctags: 1,331
  • sloc: python: 6,214; sh: 92; makefile: 37
file content (54 lines) | stat: -rw-r--r-- 904 bytes parent folder | download
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'test checking constant conditions'

# __pychecker__ = ''

def func1(x):
    'should not produce a warning'
    if 1:
        pass
    while 1:
        print x
        break
    assert x, 'test'
    return 0

def func2(x):
    'should produce a warning'
    __pychecker__ = 'constant1'
    if 1:
        pass
    while 1:
        print x
        break
    return 0

def func3(x):
    'should produce a warning'
    if 21:
        return 1
    if 31:
        return 2
    assert(x, 'test')
    assert(5, 'test')
    assert 5, 'test'

    if 'str':
        return 3

    return 4

def func4(x):
    'should not produce a warning'
    if x == 204 or x == 201 or 200 <= x < 300:
        x = 0
    if x == 1:
        pass
    while x == 'str':
        print x
        break
    return 0

def func5(need_quotes, text):
    'should not produce a warning'
    return (need_quotes) and ('"%s"' % text) or (text)