示例#1
0
 def test_arbitrarySize(self):
     s = ImageSized(DummyImage(34, 56, 78))
     self.assertEqual(s.sizeForSorting(), ('byte', 78))
     self.assertEqual(s.sizeForDisplay(), u'1 KB ${width}x${height}')
     self.assertEqual(s.sizeForDisplay().mapping['width'], '34')
     self.assertEqual(s.sizeForDisplay().mapping['height'], '56')
示例#2
0
 def test_unknownSize(self):
     s = ImageSized(DummyImage(-1, -1, 23))
     self.assertEqual(s.sizeForSorting(), ('byte', 23))
     self.assertEqual(s.sizeForDisplay(), u'1 KB ${width}x${height}')
     self.assertEqual(s.sizeForDisplay().mapping['width'], '?')
     self.assertEqual(s.sizeForDisplay().mapping['height'], '?')
示例#3
0
 def test_zeroSized(self):
     s = ImageSized(DummyImage(0, 0, 0))
     self.assertEqual(s.sizeForSorting(), ('byte', 0))
     self.assertEqual(s.sizeForDisplay(), u'0 KB ${width}x${height}')
     self.assertEqual(s.sizeForDisplay().mapping['width'], '0')
     self.assertEqual(s.sizeForDisplay().mapping['height'], '0')