示例#1
0
 def test_filename2id_all(self):
     """Test all the filenames to ids and vice versa."""
     filemap = {
         '/01/8001': (32*1024)+1,
         '/00/8000': (32*1024),
         '/ff/7fff': (32*1024)-1,
         '/file.1': 1,
         '/file.0': 0,
         '/file.-1': -1,
         '/d2/4d2': 1234
     }
     for filename, fileid in filemap.items():
         self.assertEqual(fileid, filename2id(filename), '{} should equal {}'.format(fileid, filename2id(filename)))
         self.assertEqual(id2filename(fileid), filename, '{} should equal {}'.format(id2filename(fileid), filename))
示例#2
0
 def test_id2filename_shift_point(self):
     """Test the correct creation of the shift point filename."""
     filename = id2filename((32 * 1024))
     self.assertEqual(filename, '/00/8000')
示例#3
0
 def test_id2filename_o_shift_point(self):
     """Test the correct creation of an over shift point filename."""
     filename = id2filename((32 * 1024) + 1)
     self.assertEqual(filename, '/01/8001')
示例#4
0
 def test_id2filename_u_shift_point(self):
     """Test the correct creation of an under shift point filename."""
     filename = id2filename((32 * 1024) - 1)
     self.assertEqual(filename, '/ff/7fff')
示例#5
0
 def test_id2filename_simple(self):
     """Test the correct creation of a simple filename."""
     filename = id2filename(1)
     self.assertEqual(filename, '/file.1')
示例#6
0
 def test_id2filename_zero(self):
     """Test the correct creation of a zero filename."""
     filename = id2filename(0)
     self.assertEqual(filename, '/file.0')
示例#7
0
 def test_id2filename_negative(self):
     """Test the correct creation of a negative filename."""
     filename = id2filename(-1)
     self.assertEqual(filename, '/file.-1')
示例#8
0
 def test_id2filename_basic(self):
     """Test the correct creation of a basicfilename."""
     filename = id2filename(1234)
     self.assertEqual(filename, '/d2/4d2')