~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_inv.py

(gz) Backslash escape selftest output when printing to non-unicode consoles
 (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
 
1
# Copyright (C) 2005-2010 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
from bzrlib import (
19
19
    chk_map,
20
20
    groupcompress,
21
 
    bzrdir,
22
21
    errors,
23
22
    inventory,
24
23
    osutils,
590
589
        self.assertFalse(inv.is_root('TREE_ROOT'))
591
590
        self.assertFalse(inv.is_root('booga'))
592
591
 
 
592
    def test_entries_for_empty_inventory(self):
 
593
        """Test that entries() will not fail for an empty inventory"""
 
594
        inv = Inventory(root_id=None)
 
595
        self.assertEqual([], inv.entries())
 
596
 
593
597
 
594
598
class TestInventoryEntry(TestCase):
595
599
 
607
611
 
608
612
    def test_dir_detect_changes(self):
609
613
        left = inventory.InventoryDirectory('123', 'hello.c', ROOT_ID)
610
 
        left.text_sha1 = 123
611
 
        left.executable = True
612
 
        left.symlink_target='foo'
613
614
        right = inventory.InventoryDirectory('123', 'hello.c', ROOT_ID)
614
 
        right.text_sha1 = 321
615
 
        right.symlink_target='bar'
616
615
        self.assertEqual((False, False), left.detect_changes(right))
617
616
        self.assertEqual((False, False), right.detect_changes(left))
618
617
 
632
631
 
633
632
    def test_symlink_detect_changes(self):
634
633
        left = inventory.InventoryLink('123', 'hello.c', ROOT_ID)
635
 
        left.text_sha1 = 123
636
 
        left.executable = True
637
634
        left.symlink_target='foo'
638
635
        right = inventory.InventoryLink('123', 'hello.c', ROOT_ID)
639
 
        right.text_sha1 = 321
640
636
        right.symlink_target='foo'
641
637
        self.assertEqual((False, False), left.detect_changes(right))
642
638
        self.assertEqual((False, False), right.detect_changes(left))