'Test getting the actual case for files from names on case insensitive filesystems'

def test_actual_case(self):

    from calibre.ebooks.oeb.polish.utils import actual_case_for_name, corrected_case_for_name
    book = get_simple_book()
    c = get_container(book)
    name = u'f1/f2/added    file.html'
    c.add_file(name, 'xxx')
    self.assertTrue(c.exists(name))
    variations = (name, name.upper(), name.replace(u'f1', u'F1'), name.replace(u'f2', u'F2'))
    if c.exists(name.upper()):
        for n in variations:
            self.assertEqual(name, actual_case_for_name(c, n))
    else:
        for n in variations:
            self.assertEqual(name, corrected_case_for_name(c, n))
        self.assertIsNone(corrected_case_for_name(c, (name + u'/xx')))
