def test_map_works(self):
     self.assertEqual(
         Options.map(
             {
                 "BOLD": "strong",
                 "HIGHLIGHT": {
                     "element": "strong",
                     "props": {
                         "style": {
                             "textDecoration": "underline"
                         }
                     },
                 },
             },
             "FALLBACK",
         ),
         {
             "BOLD":
             Options("BOLD", "strong"),
             "HIGHLIGHT":
             Options(
                 "HIGHLIGHT",
                 "strong",
                 props={"style": {
                     "textDecoration": "underline"
                 }},
             ),
         },
     )
Beispiel #2
0
 def test_get_raises_exception(self):
     with self.assertRaises(ConfigException):
         self.assertEqual(
             Options.get(Options.map({
                 'BOLD': 'strong',
             }, 'FALLBACK'), 'ITALIC', 'FALLBACK'),
             Options('BOLD', 'strong'))
Beispiel #3
0
 def test_get_uses_fallback(self):
     self.assertEqual(
         Options.get(
             Options.map({
                 'BOLD': 'strong',
                 'FALLBACK': 'span',
             }, 'FALLBACK'), 'ITALIC', 'FALLBACK'),
         Options('FALLBACK', 'span'))
 def test_get_raises_exception(self):
     with self.assertRaises(ConfigException):
         self.assertEqual(
             Options.get(
                 Options.map({"BOLD": "strong"}, "FALLBACK"),
                 "ITALIC",
                 "FALLBACK",
             ),
             Options("BOLD", "strong"),
         )
 def test_get_uses_fallback(self):
     self.assertEqual(
         Options.get(
             Options.map({
                 "BOLD": "strong",
                 "FALLBACK": "span"
             }, "FALLBACK"),
             "ITALIC",
             "FALLBACK",
         ),
         Options("FALLBACK", "span"),
     )
Beispiel #6
0
 def test_get_works(self):
     self.assertEqual(
         Options.get(
             Options.map(
                 {
                     'BOLD': 'strong',
                     'HIGHLIGHT': {
                         'element': 'strong',
                         'props': {
                             'style': {
                                 'textDecoration': 'underline'
                             }
                         },
                     },
                 }, 'FALLBACK'), 'BOLD', 'FALLBACK'),
         Options('BOLD', 'strong'))