Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/test/test_symtable.py

    r2 r391  
    44import symtable
    55import unittest
    6 import warnings
    76
    87from test import test_support
     
    4544class SymtableTest(unittest.TestCase):
    4645
    47     with warnings.catch_warnings():
    48         # Ignore warnings about "from blank import *"
    49         warnings.simplefilter("ignore", SyntaxWarning)
     46    with test_support.check_warnings(
     47            ("import \* only allowed at module level", SyntaxWarning)):
    5048        top = symtable.symtable(TEST_CODE, "?", "exec")
    5149    # These correspond to scopes in TEST_CODE
     
    5553    internal = find_block(spam, "internal")
    5654    foo = find_block(top, "foo")
    57 
    58     def test_noops(self):
    59         # Check methods that don't work. They should warn and return False.
    60         def check(w, msg):
    61             self.assertEqual(str(w.message), msg)
    62         sym = self.top.lookup("glob")
    63         with test_support.check_warnings() as w:
    64             warnings.simplefilter("always", DeprecationWarning)
    65             self.assertFalse(sym.is_vararg())
    66             check(w, "is_vararg() is obsolete and will be removed")
    67             w.reset()
    68             self.assertFalse(sym.is_keywordarg())
    69             check(w, "is_keywordarg() is obsolete and will be removed")
    70             w.reset()
    71             self.assertFalse(sym.is_in_tuple())
    72             check(w, "is_in_tuple() is obsolete and will be removed")
    7355
    7456    def test_type(self):
     
    10789    def test_function_info(self):
    10890        func = self.spam
    109         self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var"))
    110         self.assertEqual(func.get_locals(),
    111                          ("a", "b", "bar", "internal", "kw", "var", "x"))
    112         self.assertEqual(func.get_globals(), ("bar", "glob"))
     91        self.assertEqual(sorted(func.get_parameters()), ["a", "b", "kw", "var"])
     92        expected = ["a", "b", "internal", "kw", "var", "x"]
     93        self.assertEqual(sorted(func.get_locals()), expected)
     94        self.assertEqual(sorted(func.get_globals()), ["bar", "glob"])
    11395        self.assertEqual(self.internal.get_frees(), ("x",))
    11496
     
    149131        self.assertFalse(self.spam.lookup("x").is_namespace())
    150132
    151         self.assert_(self.top.lookup("spam").get_namespace() is self.spam)
     133        self.assertTrue(self.top.lookup("spam").get_namespace() is self.spam)
    152134        ns_test = self.top.lookup("namespace_test")
    153135        self.assertEqual(len(ns_test.get_namespaces()), 2)
Note: See TracChangeset for help on using the changeset viewer.