~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-17 00:34:28 UTC
  • mfrom: (4754 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4755.
  • Revision ID: john@arbash-meinel.com-20091017003428-opg71qwkbzr3clko
Merge bzr.dev resolve test conflict.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    _static_tuple_py,
24
24
    errors,
25
25
    osutils,
 
26
    static_tuple,
26
27
    tests,
27
28
    )
28
29
 
278
279
        self.assertCompareEqual(k3, (k1, ('foo', 'bar')))
279
280
        self.assertCompareEqual((k1, ('foo', 'bar')), k3)
280
281
 
 
282
    def test_compare_mixed_depths(self):
 
283
        stuple = self.module.StaticTuple
 
284
        k1 = stuple(stuple('a',), stuple('b',))
 
285
        k2 = stuple(stuple(stuple('c',), stuple('d',)),
 
286
                    stuple('b',))
 
287
        # This requires comparing a StaticTuple to a 'string', and then
 
288
        # interpreting that value in the next higher StaticTuple. This used to
 
289
        # generate a PyErr_BadIternalCall. We now fall back to *something*.
 
290
        self.assertCompareNoRelation(k1, k2)
 
291
 
281
292
    def test_hash(self):
282
293
        k = self.module.StaticTuple('foo')
283
294
        self.assertEqual(hash(k), hash(('foo',)))
447
458
                          self.module.StaticTuple.from_sequence, object(), 'a')
448
459
        self.assertRaises(TypeError,
449
460
                          self.module.StaticTuple.from_sequence, foo='a')
 
461
 
 
462
    def test_static_tuple_thunk(self):
 
463
        # Make sure the right implementation is available from
 
464
        # bzrlib.static_tuple.StaticTuple.
 
465
        if self.module is _static_tuple_py:
 
466
            if CompiledStaticTuple.available():
 
467
                # We will be using the C version
 
468
                return
 
469
        self.assertIs(static_tuple.StaticTuple,
 
470
                      self.module.StaticTuple)