Commits

Brodie Rao committed 5f07a67

Added __doc__ and __package__ to the list of magic globals

Comments (0)

Files changed (2)

pyflakes/checker.py

 
 
 # Globally defined names which are not attributes of the __builtin__ module.
-_MAGIC_GLOBALS = ['__file__', '__builtins__']
+_MAGIC_GLOBALS = ['__builtins__', '__doc__', '__file__', '__package__']
 
 
 

pyflakes/test/test_undefined_names.py

         self.flakes('range(10)')
 
 
-    def test_magicGlobalsFile(self):
+    def test_magicGlobals(self):
         """
-        Use of the C{__file__} magic global should not emit an undefined name
-        warning.
-        """
-        self.flakes('__file__')
-
-
-    def test_magicGlobalsBuiltins(self):
-        """
-        Use of the C{__builtins__} magic global should not emit an undefined
-        name warning.
+        Use of magic globals should not emit undefined name warnings.
         """
         self.flakes('__builtins__')
+        self.flakes('__doc__')
+        self.flakes('__file__')
+        self.flakes('__package__')
 
 
     def test_magicGlobalsName(self):