Update tests

This commit is contained in:
Marek Marczykowski-Górecki 2017-12-21 19:44:46 +01:00
parent 3e41a2987c
commit 2ac5c03bb3
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -24,8 +24,8 @@ class TestCaseImage(unittest.TestCase):
image = self.image.tint('#0000ff') image = self.image.tint('#0000ff')
self.assertEqual(image._rgba, self.assertEqual(image._rgba,
'\x00\x00\x00\xff' '\x00\x00\xff\xff' '\x00\x00\x3f\xff' '\x00\x00\xff\xff'
'\x00\x00\xff\xff' '\x00\x00\x00\xff') '\x00\x00\xff\xff' '\x00\x00\x3f\xff')
def test_10_get_from_stream(self): def test_10_get_from_stream(self):
io = StringIO.StringIO('{0[0]} {0[1]}\n{1}'.format(self.size, self.rgba)) io = StringIO.StringIO('{0[0]} {0[1]}\n{1}'.format(self.size, self.rgba))
@ -63,14 +63,15 @@ class TestCaseFunctionsAndConstants(unittest.TestCase):
self.assertIsNone(qubesimgconverter.re_imghdr.match('x yx\n')) self.assertIsNone(qubesimgconverter.re_imghdr.match('x yx\n'))
def test_10_hex_to_float_result_00(self): def test_10_hex_to_float_result_00(self):
self.assertEqual(qubesimgconverter.hex_to_float('#000000'), (0.0, 0.0, 0.0)) self.assertEqual(qubesimgconverter.hex_to_int('#000000'), (0, 0, 0))
def test_11_hex_to_float_result_ff(self): def test_11_hex_to_float_result_ff(self):
self.assertEqual(qubesimgconverter.hex_to_float('0xffffff'), (1.0, 1.0, 1.0)) self.assertEqual(qubesimgconverter.hex_to_int('0xffffff'),
(0xff, 0xff, 0xff))
def test_12_hex_to_float_depth_3_not_implemented(self): def test_12_hex_to_float_depth_3_not_implemented(self):
with self.assertRaises(NotImplementedError): with self.assertRaises(ValueError):
qubesimgconverter.hex_to_float('123456', depth=3) qubesimgconverter.hex_to_int('123456', depth=3)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()