예제 #1
0
 def test_bad_format_string_multiple(self):
     """Multple format spec in string is disallowed"""
     with pytest.raises(exceptions.InvalidFormattedJsonError):
         format_keys(ForceIncludeToken("{a}{b}"), {"fd": "123"})
예제 #2
0
 def test_bad_format_string_extra(self):
     """Extra things in format string"""
     with pytest.raises(exceptions.InvalidFormattedJsonError):
         format_keys(ForceIncludeToken("{fd}gg"), {"fd": "123"})
예제 #3
0
 def test_bad_format_string_conversion(self):
     """No format string"""
     with pytest.raises(exceptions.InvalidFormattedJsonError):
         format_keys(ForceIncludeToken(""), {"fd": "123"})
예제 #4
0
    def test_custom_format(self, item):
        """Can format everything"""
        val = format_keys(ForceIncludeToken("{fd}"), {"fd": item})

        assert val == item