~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__static_tuple.py

  • Committer: Matt Nordhoff
  • Date: 2009-10-27 09:25:31 UTC
  • mto: This revision was merged to the branch mainline in revision 4774.
  • Revision ID: mnordhoff@mattnordhoff.com-20091027092531-q0lygzntui81p7qn
_static_tuple_c.StaticTuple.from_sequence() now supports arbitrary iterables (by converting them to tuples first).

(I basically copied and pasted an example from jam. Except for the ugly reference counting; that was all me.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
578
578
        self.assertRaises(TypeError,
579
579
                          self.module.StaticTuple.from_sequence, foo='a')
580
580
 
 
581
    def test_from_sequence_iterable(self):
 
582
        st = self.module.StaticTuple.from_sequence(iter(('foo', 'bar')))
 
583
        self.assertIsInstance(st, self.module.StaticTuple)
 
584
        self.assertEqual(('foo', 'bar'), st)
 
585
 
581
586
    def test_pickle(self):
582
587
        st = self.module.StaticTuple('foo', 'bar')
583
588
        pickled = cPickle.dumps(st)