Lines Matching refs:namedtuple
15 from collections import namedtuple, Counter, OrderedDict
25 TestNT = namedtuple('TestNT', 'x y z') # type used for pickle tests
67 Point = namedtuple('Point', 'x y')
74 self.assertRaises(ValueError, namedtuple, 'abc%', 'efg ghi') # type has non-alpha char
75 self.assertRaises(ValueError, namedtuple, 'class', 'efg ghi') # type has keyword
76 self.assertRaises(ValueError, namedtuple, '9abc', 'efg ghi') # type starts with digit
78 … self.assertRaises(ValueError, namedtuple, 'abc', 'efg g%hi') # field with non-alpha char
79 self.assertRaises(ValueError, namedtuple, 'abc', 'abc class') # field has keyword
80 self.assertRaises(ValueError, namedtuple, 'abc', '8efg 9ghi') # field starts with digit
81 … self.assertRaises(ValueError, namedtuple, 'abc', '_efg ghi') # field with leading underscore
82 self.assertRaises(ValueError, namedtuple, 'abc', 'efg efg ghi') # duplicate field
84 namedtuple('Point0', 'x1 y2') # Verify that numbers are allowed in names
85 namedtuple('_', 'a b c') # Test leading underscores in a typename
87 nt = namedtuple('nt', u'the quick brown fox') # check unicode input
89 nt = namedtuple('nt', (u'the', u'quick')) # check unicode input
98 Point = namedtuple('Point', 'x y')
110 self.assertEqual(namedtuple('NT', spec, rename=True)._fields, renamed)
113 Point = namedtuple('Point', 'x y')
140 Point = namedtuple('Point', 'x, y')
145 Point = namedtuple('Point', ('x', 'y'))
150 Point = namedtuple('Point', 'x y')
169 Zero = namedtuple('Zero', '')
176 Dot = namedtuple('Dot', 'd')
189 Big = namedtuple('Big', names)
226 T = namedtuple('T', 'itemgetter property self cls tuple')
234 T = namedtuple('T', 'x', verbose=True)
237 T = namedtuple('T', words)