def test_mapping(self):
     for ns in NameStyle:
         for trailing in TRAILING_VARIANTS:
             self.assertEqual(
                 convert_name('BadSnakeName', ns,
                              {'BadSnakeName': 'MappedName'}, trailing),
                 'MappedName')
    def test_value_error(self):
        for ns in NameStyle:
            if ns is not NameStyle.ignore:
                self.assert_raise_value_error(ns)

        for trailing in TRAILING_VARIANTS:
            self.assertEqual(
                convert_name('BadSnakeName', NameStyle.ignore, None, trailing),
                'BadSnakeName')
 def assert_convert(self, name_style: NameStyle, snake_name: str,
                    result_name: str):
     self.assertEqual(result_name,
                      convert_name(snake_name, name_style, None, True))
 def assert_raise_value_error(self, name_style: NameStyle):
     for trailing in TRAILING_VARIANTS:
         with self.assertRaises(ValueError):
             convert_name('BadSnakeName', name_style, None, trailing)