~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__static_tuple.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-27 14:07:16 UTC
  • mto: This revision was merged to the branch mainline in revision 4774.
  • Revision ID: john@arbash-meinel.com-20091027140716-ggors1mphschb5yo
Clean up the C code a bit, using a goto.

Show diffs side-by-side

added added

removed removed

Lines of Context:
571
571
    def test_from_sequence_not_sequence(self):
572
572
        self.assertRaises(TypeError,
573
573
                          self.module.StaticTuple.from_sequence, object())
 
574
        self.assertRaises(TypeError,
 
575
                          self.module.StaticTuple.from_sequence, 10)
574
576
 
575
577
    def test_from_sequence_incorrect_args(self):
576
578
        self.assertRaises(TypeError,
579
581
                          self.module.StaticTuple.from_sequence, foo='a')
580
582
 
581
583
    def test_from_sequence_iterable(self):
582
 
        st = self.module.StaticTuple.from_sequence(iter(('foo', 'bar')))
 
584
        st = self.module.StaticTuple.from_sequence(iter(['foo', 'bar']))
 
585
        self.assertIsInstance(st, self.module.StaticTuple)
 
586
        self.assertEqual(('foo', 'bar'), st)
 
587
 
 
588
    def test_from_sequence_generator(self):
 
589
        def generate_tuple():
 
590
            yield 'foo'
 
591
            yield 'bar'
 
592
        st = self.module.StaticTuple.from_sequence(generate_tuple())
583
593
        self.assertIsInstance(st, self.module.StaticTuple)
584
594
        self.assertEqual(('foo', 'bar'), st)
585
595