/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test__static_tuple.py

  • Committer: John Arbash Meinel
  • Date: 2009-10-18 17:53:25 UTC
  • mfrom: (4756 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4758.
  • Revision ID: john@arbash-meinel.com-20091018175325-m7s57yrmm3bvj9b3
Merge in the latest bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
428
428
            return
429
429
        self.assertIsNot(None, self.module._C_API)
430
430
 
 
431
    def test_from_sequence_tuple(self):
 
432
        st = self.module.StaticTuple.from_sequence(('foo', 'bar'))
 
433
        self.assertIsInstance(st, self.module.StaticTuple)
 
434
        self.assertEqual(('foo', 'bar'), st)
 
435
 
 
436
    def test_from_sequence_str(self):
 
437
        st = self.module.StaticTuple.from_sequence('foo')
 
438
        self.assertIsInstance(st, self.module.StaticTuple)
 
439
        self.assertEqual(('f', 'o', 'o'), st)
 
440
 
 
441
    def test_from_sequence_list(self):
 
442
        st = self.module.StaticTuple.from_sequence(['foo', 'bar'])
 
443
        self.assertIsInstance(st, self.module.StaticTuple)
 
444
        self.assertEqual(('foo', 'bar'), st)
 
445
 
 
446
    def test_from_sequence_static_tuple(self):
 
447
        st = self.module.StaticTuple('foo', 'bar')
 
448
        st2 = self.module.StaticTuple.from_sequence(st)
 
449
        # If the source is a StaticTuple already, we return the exact object
 
450
        self.assertIs(st, st2)
 
451
 
 
452
    def test_from_sequence_not_sequence(self):
 
453
        self.assertRaises(TypeError,
 
454
                          self.module.StaticTuple.from_sequence, object())
 
455
 
 
456
    def test_from_sequence_incorrect_args(self):
 
457
        self.assertRaises(TypeError,
 
458
                          self.module.StaticTuple.from_sequence, object(), 'a')
 
459
        self.assertRaises(TypeError,
 
460
                          self.module.StaticTuple.from_sequence, foo='a')
 
461
 
431
462
    def test_static_tuple_thunk(self):
432
463
        # Make sure the right implementation is available from
433
464
        # bzrlib.static_tuple.StaticTuple.
435
466
            if CompiledStaticTuple.available():
436
467
                # We will be using the C version
437
468
                return
438
 
        self.assertIs(static_tuple.StaticTuple, 
 
469
        self.assertIs(static_tuple.StaticTuple,
439
470
                      self.module.StaticTuple)