File: test79.py

package info (click to toggle)
pychecker 0.8.19-10
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,484 kB
  • ctags: 2,114
  • sloc: python: 9,968; sh: 98; makefile: 13
file content (33 lines) | stat: -rw-r--r-- 576 bytes parent folder | download | duplicates (9)
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
'test iterating over a string'

__pychecker__ = 'stringiter'

def func1():
    'should generate a warning'
    s = 'string'
    for c in s:
        print 'oops', c[0]

def func2():
    'should generate a warning'
    f = open('/dev/null')
    s = f.read()
    for c in s:
        print 'oops', c[0]

def func3():
    'should not generate a warning'
    for i in []:
        print 'ok', i
    for i in ():
        print 'ok', i

def func4():
    'should not generate a warning'
    v = []
    for i in v:
        print 'ok', i
    w = ()
    for i in w:
        print 'ok', i