• Home
  • Raw
  • Download

Lines Matching refs:namedtuple

16 from collections import namedtuple, Counter, OrderedDict, _count_elements
302 TestNT = namedtuple('TestNT', 'x y z') # type used for pickle tests
307 Point = namedtuple('Point', 'x y')
314 self.assertRaises(ValueError, namedtuple, 'abc%', 'efg ghi') # type has non-alpha char
315 self.assertRaises(ValueError, namedtuple, 'class', 'efg ghi') # type has keyword
316 self.assertRaises(ValueError, namedtuple, '9abc', 'efg ghi') # type starts with digit
318 … self.assertRaises(ValueError, namedtuple, 'abc', 'efg g%hi') # field with non-alpha char
319 self.assertRaises(ValueError, namedtuple, 'abc', 'abc class') # field has keyword
320 self.assertRaises(ValueError, namedtuple, 'abc', '8efg 9ghi') # field starts with digit
321 … self.assertRaises(ValueError, namedtuple, 'abc', '_efg ghi') # field with leading underscore
322 self.assertRaises(ValueError, namedtuple, 'abc', 'efg efg ghi') # duplicate field
324 namedtuple('Point0', 'x1 y2') # Verify that numbers are allowed in names
325 namedtuple('_', 'a b c') # Test leading underscores in a typename
327 nt = namedtuple('nt', 'the quick brown fox') # check unicode input
329 nt = namedtuple('nt', ('the', 'quick')) # check unicode input
336 Point = namedtuple('Point', 'x y', defaults=(10, 20)) # 2 defaults
342 Point = namedtuple('Point', 'x y', defaults=(20,)) # 1 default
347 Point = namedtuple('Point', 'x y', defaults=()) # 0 defaults
358 Point = namedtuple('Point', 'x y', defaults=(10, 20, 30))
360 Point = namedtuple('Point', 'x y', defaults=10)
362 Point = namedtuple('Point', 'x y', defaults=False)
364 Point = namedtuple('Point', 'x y', defaults=None) # default is None
371 … Point = namedtuple('Point', 'x y', defaults=[10, 20]) # allow non-tuple iterable
378 Point = namedtuple('Point', 'x y', defaults=iter([10, 20])) # allow plain iterator
386 Point = namedtuple('Point', 'x y')
402 Point = namedtuple('Point', 'x y')
410 Point = namedtuple('Point', 'x y')
416 Vector = namedtuple('Vector', 'x y')
425 P = namedtuple('P', ['m', 'n'])
426 Q = namedtuple('Q', ['o', 'p'])
432 Point = namedtuple('Point', 'x y')
451 self.assertEqual(namedtuple('NT', spec, rename=True)._fields, renamed)
454 NT = namedtuple('NT', ['x', 'y'], module=collections)
458 Point = namedtuple('Point', 'x y')
486 Point = namedtuple('Point', 'x, y')
491 Point = namedtuple('Point', ('x', 'y'))
496 Point = namedtuple('Point', 'x y')
519 Zero = namedtuple('Zero', '')
526 Dot = namedtuple('Dot', 'd')
539 Big = namedtuple('Big', names)
577 T = namedtuple('T', 'itemgetter property self cls tuple')
614 T = namedtuple('T', words)
639 A = namedtuple('A', 'x')
649 NT = namedtuple('NT', ['x', 'y'], True)
651 NT = namedtuple('NT', ['abc', 'def'], rename=True)
654 NT = namedtuple('NT', ['abc', 'def'], False, True)
657 class Point(namedtuple('_Point', ['x', 'y'])):
667 Point = namedtuple('Point', 'x y')