/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

(jam) Start using StaticTuple as part of the btree_index parsing code.

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',)))
416
427
        if self.module is _static_tuple_py:
417
428
            return
418
429
        self.assertIsNot(None, self.module._C_API)
 
430
 
 
431
    def test_static_tuple_thunk(self):
 
432
        # Make sure the right implementation is available from
 
433
        # bzrlib.static_tuple.StaticTuple.
 
434
        if self.module is _static_tuple_py:
 
435
            if CompiledStaticTuple.available():
 
436
                # We will be using the C version
 
437
                return
 
438
        self.assertIs(static_tuple.StaticTuple, 
 
439
                      self.module.StaticTuple)