6 Generic Enum testing framework
8 Tests expected values of enum and string conversions
9 Inherit this class to test typical gnsstk strongly typed enums.
11 For each subclass, create the `ENUM`, `EXP_ENUM_STRS`, and `STR_CONVERTER`
14 ENUM: The enum to test (e.g. gnsstk.CorrDupHandling)
15 EXP_ENUM_STRS: A dictionary of enum values and their expected string equivalent
16 STR_CONVERTER: the function the converts strings into enum values
24 actual_items = set(self.ENUM) - {self.ENUM.Last}
25 self.assertEqual(set(self.EXP_ENUM_STRS.keys()), actual_items)
27 for exp_enum, exp_enum_str
in self.EXP_ENUM_STRS.items():
28 with self.subTest(enum=exp_enum):
29 self.assertEqual(str(exp_enum), exp_enum_str)
32 str_converter = self.STR_CONVERTER.__func__
33 self.assertEqual(str_converter(exp_enum_str), exp_enum)