from pychecker2.TestSupport import WarningTester
from pychecker2 import ScopeChecks

class RedefinedTestCase(WarningTester):
    def testScopes(self):
        self.warning('def f(): pass\n'
                     'def f(): pass\n',
                     1, ScopeChecks.RedefineCheck.redefinedScope, 'f', 2)
        self.warning('class C:\n'
                     '  def g(self): pass\n'
                     '  def g(self): pass\n',
                     2, ScopeChecks.RedefineCheck.redefinedScope, 'g', 3)
        self.silent('def s(): pass\n'
                    'def f(): pass\n')

@@ -144,16 +144,69 @@
 (self):%0A
+        w = ScopeChecks.RedefineCheck.redefinedScope%0A
         
@@ -304,48 +304,9 @@
  1, 
-ScopeChecks.RedefineCheck.redefinedScope
+w
 , 'f
@@ -464,56 +464,489 @@
  2, 
-ScopeChecks.RedefineCheck.redefinedScope, 'g', 3
+w, 'g', 3)%0A        self.silent('def s(): pass%5Cn'%0A                    'def f(): pass%5Cn')%0A        self.silent('import sys%5Cn'%0A                    'if sys.argv:%5Cn'%0A                    '   def f(): return 1%5Cn'%0A                    'else:%5Cn'%0A                    '   def f(): return 0%5Cn')%0A        self.warning('import sys%5Cn'%0A                     'if sys.argv:%5Cn'%0A                     '   def f(): return 1%5Cn'%0A                     '   def f(): return 0%5Cn',%0A                     3, w, 'f', 4
 )%0A  
@@ -960,68 +960,256 @@
 elf.
-silent('
+warning('try:%5Cn'%0A                     '   
 def 
-s
+f
 (): 
-pass%5Cn'%0A                    'def f(): pass%5Cn'
+return 1%5Cn'%0A                     'except Exception:%5Cn'%0A                     '   pass%5Cn'%0A                     'else:%5Cn'%0A                     '   def f(): return 0%5Cn',%0A                     2, w, 'f', 6
 )%0A

check for exclusive try/else and if/else