def test_write_spds_to_csv_file(self): """ Tests :func:`colour.io.tabular.write_spds_to_csv_file` definition. """ colorchecker_n_ohta = os.path.join(RESOURCES_DIRECTORY, 'colorchecker_n_ohta.csv') spds = read_spds_from_csv_file(colorchecker_n_ohta) colorchecker_n_ohta_test = os.path.join(self.__temporary_directory, 'colorchecker_n_ohta.csv') write_spds_to_csv_file(spds, colorchecker_n_ohta_test) spds_test = read_spds_from_csv_file(colorchecker_n_ohta_test) for key, value in spds.items(): self.assertEqual(value, spds_test[key]) write_spds_to_csv_file(spds, colorchecker_n_ohta_test, fields=['1']) spds_test = read_spds_from_csv_file(colorchecker_n_ohta_test) self.assertEqual(len(spds_test), 1)
def test_read_spds_from_csv_file(self): """ Tests :func:`colour.io.tabular.read_spds_from_csv_file` definition. """ colorchecker_n_ohta = os.path.join(RESOURCES_DIRECTORY, 'colorchecker_n_ohta.csv') spds = read_spds_from_csv_file(colorchecker_n_ohta) for spd in spds.values(): self.assertIsInstance(spd, SpectralPowerDistribution) self.assertEqual(spds['1'], SpectralPowerDistribution('1', COLORCHECKER_N_OHTA_1))