test68.py :  » Development » PyChecker » pychecker-0.8.18 » test_input » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Development » PyChecker 
PyChecker » pychecker 0.8.18 » test_input » test68.py
'test implicit returns'

__pychecker__ = 'implicitreturns'

def func1(x):
    'should not produce a warning'
    if x == 1:
        return 1
    return 0

def func2(x):
    'should produce a warning'
    if x == 1:
        return 1

def func3(x):
    'should not produce a warning'
    while 1:
        if x == 1:
            return 1
        x = x / 2
    return 0

def func4(x):
    'should not produce a warning'
    while 1:
        if x == 1:
            return 1
        x = x / 2

def func5(x):
    'should not produce a warning'
    while 1:
        if x == 1:
            return 1
    return 0

def func6(x):
    'should produce a warning'
    while 1:
        if x == 1:
            return 1
        break

def func7(x):
    'should not produce a warning'
    try:
        print x
        return 2
    except:
        pass
    return 0

def func8(x):
    'should produce a warning'
    try:
        if x == 1:
            return 3
        if x == 2:
            return 6
    except:
        pass

def func9(x):
    'should not produce a warning'
    try:
        return x
    except:
        return 0

def func10(x):
    'should not produce a warning'
    if x:
        raise ValueError

def func11(x):
    'should not produce a warning'
    if x:
        raise ValueError
    return 5

def func12(x):
    'should not produce a warning'
    raise ValueError, 'test'

def func13(x):
    'should not produce a warning'
    if x == 1:
        return 1
    else:
        return 0

def func14(x):
    'should not produce a warning'
    try:
        if x == 1:
            return 3
        return 6
    except:
        raise

def func15(x):
    'should not produce a warning'
    try:
        return x.j
    except AttributeError:
        return 0

def func16(x):
    'should not produce a warning'
    try:
        return x.j
    except AttributeError:
        raise

def func17(x):
    'should not produce a warning'
    try:
        return x.j
    except (AttributeError, KeyError, IndexError):
        return 0

def func18(x):
    if x == 'n':
        return x
    if x != 'j':
        raise AttributeError

def func19(x):
    'should not produce a warning'
    while 1:
        if x:
            x = x + 1
        return 1

def func20(x):
    'should produce a warning'
    while 1:
        if x:
            break
        return 1

def func21(x):
    'should not produce a warning'
    try:
        if x == 1:
            return 3
        return 6
    finally:
        print 'do nothing'

def func22(x):
    'should not produce a warning'
    while 1:
        for _ in range(10) :
            x = x / 2
            break
        return 1

def catchup(slave, image, inProgress):
    d = func1.bogus()
    def next_func():
        defer = slave.call('', image.next())
        try:
            defer.add(d.errback)
        except:
            slave.call(inProgress)
    next_func()
    return d

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.