| Total Complexity | 6 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | import unittest |
||
| 6 | class DataURIConverterTestCase(unittest.TestCase): |
||
| 7 | def data_dir(self, filename): |
||
| 8 | test_data = join(dirname(__file__), 'data') |
||
| 9 | return join(test_data, filename) |
||
| 10 | |||
| 11 | def test_local_image(self): |
||
| 12 | location = self.data_dir('bokeh-logo.png') |
||
| 13 | output = DataURIConverter(location)() |
||
| 14 | self.assertEqual(output[0:5], "iVBOR") |
||
| 15 | |||
| 16 | def test_file_not_found(self): |
||
| 17 | location = self.data_dir('no-exists.png') |
||
| 18 | with self.assertRaises(IOError): |
||
| 19 | DataURIConverter(location)() |
||
| 20 | |||
| 21 | def test_is_python_3(self): |
||
| 22 | output = DataURIConverter('') |
||
| 23 | self.assertIsInstance(output.is_py3(), bool) |
||
| 24 | |||
| 25 | def test_is_url(self): |
||
| 26 | location = 'http://docs.continuum.io/_static/img/continuum_analytics_logo.png' |
||
| 27 | self.assertTrue(DataURIConverter(location).is_url()) |
||
| 28 | |||
| 29 | location = self.data_dir('bokeh-logo.png') |
||
| 30 | self.assertNotEqual(DataURIConverter(location).is_url(), True) |
||
| 31 |