Example #1
0
    def test_flagListSetting(self):
        """Test that a list of strings can be converted to a list of flags and back."""
        flagsAsStringList = ["DUCT", "FUEL", "CLAD"]
        flagsAsFlagList = [Flags.DUCT, Flags.FUEL, Flags.CLAD]

        fs = setting.FlagListSetting(name="testFlagSetting", default=[])
        # Set the value as a list of strings first
        fs.value = flagsAsStringList
        self.assertEqual(fs.value, flagsAsFlagList)
        self.assertEqual(fs.dump(), flagsAsStringList)

        # Set the value as a list of flags
        fs.value = flagsAsFlagList
        self.assertEqual(fs.value, flagsAsFlagList)
        self.assertEqual(fs.dump(), flagsAsStringList)
Example #2
0
 def test_invalidFlagListTypeError(self):
     """Test raising a TypeError when a list is not provided."""
     fs = setting.FlagListSetting(name="testFlagSetting", default=[])
     with self.assertRaises(TypeError):
         fs.value = "DUCT"