~ubuntu-branches/debian/sid/calibre/sid

« back to all changes in this revision

Viewing changes to src/calibre/ebooks/oeb/polish/tests/container.py

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2014-02-27 07:48:06 UTC
  • mto: This revision was merged to the branch mainline in revision 74.
  • Revision ID: package-import@ubuntu.com-20140227074806-64wdebb3ptosxhhx
Tags: upstream-1.25.0+dfsg
ImportĀ upstreamĀ versionĀ 1.25.0+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
185
185
 
186
186
        self.check_links(c)
187
187
 
 
188
    def test_actual_case(self):
 
189
        ' Test getting the actual case for files from names on case insensitive filesystems '
 
190
        from calibre.ebooks.oeb.polish.utils import actual_case_for_name, corrected_case_for_name
 
191
        book = get_simple_book()
 
192
        c = get_container(book)
 
193
        name = 'f1/f2/added file.html'
 
194
        c.add_file(name, b'xxx')
 
195
        self.assertTrue(c.exists(name))
 
196
        variations = (name, name.upper(), name.replace('f1', 'F1'), name.replace('f2', 'F2'))
 
197
        if c.exists(name.upper()):
 
198
            for n in variations:
 
199
                self.assertEqual(name, actual_case_for_name(c, n))
 
200
        else:
 
201
            for n in variations:
 
202
                self.assertEqual(name, corrected_case_for_name(c, n))
 
203
            self.assertIsNone(corrected_case_for_name(c, name+'/xx'))
 
204
 
188
205
    def test_split_file(self):
189
206
        ' Test splitting of files '
190
207
        book = get_split_book()