def test_check_attributes(self):
        outlutfile = os.path.join(self.tmp_dir, "test.cube")
        default_preset = presets.get_default_preset()
        CUBE_HELPER.check_preset(default_preset)
        # test missing attr
        cust_preset = {}
        self.failUnlessRaises(presets.PresetException,
                              CUBE_HELPER.check_preset, cust_preset)
        for attr in presets.BASIC_ATTRS:
            cust_preset[attr] = default_preset[attr]
            self.failUnlessRaises(presets.PresetException,
                              CUBE_HELPER.check_preset, cust_preset)
        ## test specific attr
        # change type to 1D
        cust_preset[presets.TYPE] = '1D'
        self.failUnlessRaises(presets.PresetException,
                              CUBE_HELPER.check_preset, cust_preset)
        cust_preset[presets.OUT_BITDEPTH] = 12
        CUBE_HELPER.check_preset(cust_preset)
        # try to write a 3D LUT with a 1D preset
        self.failUnlessRaises(alh.AbstractLUTException,
                              CUBE_HELPER.write_3d_lut,
                              self.processor_1d,
                              outlutfile,
                              cust_preset)
        # change type to 2D
        cust_preset[presets.TYPE] = '3D'
        self.failUnlessRaises(presets.PresetException,
                              CUBE_HELPER.check_preset, cust_preset)
        cust_preset[presets.CUBE_SIZE] = 17
        CUBE_HELPER.check_preset(cust_preset)
        # try to write a 1D LUT with a 3D preset
        self.failUnlessRaises(alh.AbstractLUTException,
                              CUBE_HELPER.write_1d_lut,
                              self.processor_1d,
                              outlutfile,
                              cust_preset)
        # # test value type
        # cube size
        cust_preset[presets.CUBE_SIZE] = presets.CUBE_SIZE_MAX_VALUE + 1
        self.failUnlessRaises(presets.PresetException,
                              CUBE_HELPER.check_preset, cust_preset)
        cust_preset[presets.CUBE_SIZE] = default_preset[presets.CUBE_SIZE]
        # range
        tests = 'test', ['a', 'a'], [0.0, 0.5, 1.0], 0.1
        for test in tests:
            cust_preset[presets.IN_RANGE] = test
            self.failUnlessRaises(presets.PresetException,
                                  CUBE_HELPER.check_preset,
                                  cust_preset)
        cust_preset[presets.IN_RANGE] = 0.1, 1
        CUBE_HELPER.check_preset(cust_preset)
        cust_preset[presets.IN_RANGE] = (0.1, 1)
        CUBE_HELPER.check_preset(cust_preset)
Test preset check function
dataset/ETHPy150Open mikrosimage/ColorPipe-tools/test/abstract_lut_test.py/AbstractLUTTest.test_check_attributes