~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_content_filters.py

  • Committer: Ian Clatworthy
  • Date: 2008-12-18 06:41:29 UTC
  • mto: (4171.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 4173.
  • Revision ID: ian.clatworthy@canonical.com-20081218064129-ifzxuk0lbftgf67v
add and use supports_content_filtering API

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        # test handling when read then write gives back the initial content
66
66
        tree, txt_fileid, bin_fileid = self.create_cf_tree(
67
67
            txt_reader=_swapcase, txt_writer=_swapcase)
68
 
        # Check that the basis tree has the transformed content
 
68
        # Check that the basis tree has the expected content
69
69
        basis = tree.basis_tree()
70
70
        basis.lock_read()
71
71
        self.addCleanup(basis.unlock)
72
 
        self.assertEqual('fOO tXT', basis.get_file_text(txt_fileid))
 
72
        if tree.supports_content_filtering():
 
73
            expected = "fOO tXT"
 
74
        else:
 
75
            expected = "Foo Txt"
 
76
        self.assertEqual(expected, basis.get_file_text(txt_fileid))
73
77
        self.assertEqual('Foo Bin', basis.get_file_text(bin_fileid))
74
78
        # Check that the working tree has the original content
75
79
        tree.lock_read()
83
87
        # test handling with a read filter but no write filter
84
88
        tree, txt_fileid, bin_fileid = self.create_cf_tree(
85
89
            txt_reader=_uppercase, txt_writer=None)
86
 
        # Check that the basis tree has the transformed content
 
90
        # Check that the basis tree has the expected content
87
91
        basis = tree.basis_tree()
88
92
        basis.lock_read()
89
93
        self.addCleanup(basis.unlock)
90
 
        self.assertEqual('FOO TXT', basis.get_file_text(txt_fileid))
 
94
        if tree.supports_content_filtering():
 
95
            expected = "FOO TXT"
 
96
        else:
 
97
            expected = "Foo Txt"
 
98
        self.assertEqual(expected, basis.get_file_text(txt_fileid))
91
99
        self.assertEqual('Foo Bin', basis.get_file_text(bin_fileid))
92
100
        # We expect the workingtree content to be unchanged (for now at least)
93
101
        tree.lock_read()