• Home
  • Raw
  • Download

Lines Matching refs:namedtuple

17 from collections import namedtuple, Counter, OrderedDict, _count_elements
217 TestNT = namedtuple('TestNT', 'x y z') # type used for pickle tests
222 Point = namedtuple('Point', 'x y')
229 self.assertRaises(ValueError, namedtuple, 'abc%', 'efg ghi') # type has non-alpha char
230 self.assertRaises(ValueError, namedtuple, 'class', 'efg ghi') # type has keyword
231 self.assertRaises(ValueError, namedtuple, '9abc', 'efg ghi') # type starts with digit
233 … self.assertRaises(ValueError, namedtuple, 'abc', 'efg g%hi') # field with non-alpha char
234 self.assertRaises(ValueError, namedtuple, 'abc', 'abc class') # field has keyword
235 self.assertRaises(ValueError, namedtuple, 'abc', '8efg 9ghi') # field starts with digit
236 … self.assertRaises(ValueError, namedtuple, 'abc', '_efg ghi') # field with leading underscore
237 self.assertRaises(ValueError, namedtuple, 'abc', 'efg efg ghi') # duplicate field
239 namedtuple('Point0', 'x1 y2') # Verify that numbers are allowed in names
240 namedtuple('_', 'a b c') # Test leading underscores in a typename
242 nt = namedtuple('nt', 'the quick brown fox') # check unicode input
244 nt = namedtuple('nt', ('the', 'quick')) # check unicode input
251 Point = namedtuple('Point', 'x y', defaults=(10, 20)) # 2 defaults
257 Point = namedtuple('Point', 'x y', defaults=(20,)) # 1 default
262 Point = namedtuple('Point', 'x y', defaults=()) # 0 defaults
273 Point = namedtuple('Point', 'x y', defaults=(10, 20, 30))
275 Point = namedtuple('Point', 'x y', defaults=10)
277 Point = namedtuple('Point', 'x y', defaults=False)
279 Point = namedtuple('Point', 'x y', defaults=None) # default is None
286 … Point = namedtuple('Point', 'x y', defaults=[10, 20]) # allow non-tuple iterable
293 Point = namedtuple('Point', 'x y', defaults=iter([10, 20])) # allow plain iterator
304 Point = namedtuple('Point', 'x y')
310 Point = namedtuple('Point', 'x y')
324 self.assertEqual(namedtuple('NT', spec, rename=True)._fields, renamed)
327 NT = namedtuple('NT', ['x', 'y'], module=collections)
331 Point = namedtuple('Point', 'x y')
357 Point = namedtuple('Point', 'x, y')
362 Point = namedtuple('Point', ('x', 'y'))
367 Point = namedtuple('Point', 'x y')
386 Zero = namedtuple('Zero', '')
393 Dot = namedtuple('Dot', 'd')
406 Big = namedtuple('Big', names)
444 T = namedtuple('T', 'itemgetter property self cls tuple')
481 T = namedtuple('T', words)
506 A = namedtuple('A', 'x')
516 NT = namedtuple('NT', ['x', 'y'], True)
518 NT = namedtuple('NT', ['abc', 'def'], rename=True)
521 NT = namedtuple('NT', ['abc', 'def'], False, True)
524 class Point(namedtuple('_Point', ['x', 'y'])):