File: test70.py

package info (click to toggle)
pychecker 0.8.17-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,856 kB
  • ctags: 1,896
  • sloc: python: 9,301; sh: 131; makefile: 44
file content (60 lines) | stat: -rw-r--r-- 1,020 bytes parent folder | download | duplicates (4)
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
55
56
57
58
59
60
'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)

def func6(x):
    'should not produce warnings'
    if x & 32:
        print 'ya'
    if 32 & x:
        print 'ya'