Exemple #1
0
 def test_one_link(self):
     data = [('foo:URL', [(('foo', ), {
         WRITE_AS_LINK_OPTION: True,
         IGNORE_OPTION: False
     })]),
             ('foo:INLINE', [(('foo', ), {
                 WRITE_AS_LINK_OPTION: False,
                 IGNORE_OPTION: False
             })]), ('foo:OFF', [(('foo', ), {
                 IGNORE_OPTION: True
             })]),
             ('foo.bar:URL', [(('foo', ), {
                 WRITE_AS_LINK_OPTION: False,
                 IGNORE_OPTION: False
             }),
                              (('foo', 'bar'), {
                                  WRITE_AS_LINK_OPTION: True,
                                  IGNORE_OPTION: False
                              })])]
     for (expr, expected) in data:
         result = parse_refs(expr)
         self.assert_true(isinstance(result, dict))
         for item in expected:
             (key, opts) = item
             self.assert_true(key in result)
             self.assert_equal(result[key], opts)
Exemple #2
0
 def test_one_link(self):
     data = [('foo:URL', [(('foo',), {WRITE_AS_LINK_OPTION:True,
                                      IGNORE_OPTION:False})
                          ]
              ),
             ('foo:INLINE', [(('foo',), {WRITE_AS_LINK_OPTION:False,
                                         IGNORE_OPTION:False})
                             ]
              ),
             ('foo:OFF', [(('foo',), {IGNORE_OPTION:True})
                          ]
              ),
             ('foo.bar:URL', [(('foo',), {WRITE_AS_LINK_OPTION:False,
                                          IGNORE_OPTION:False}),
                              (('foo', 'bar'), {WRITE_AS_LINK_OPTION:True,
                                                IGNORE_OPTION:False})
                              ]
              )
             ]
     for (expr, expected) in data:
         result = parse_refs(expr)
         self.assert_true(isinstance(result, dict))
         for item in expected:
             (key, opts) = item
             self.assert_true(key in result)
             self.assert_equal(result[key], opts)
Exemple #3
0
 def make_refs_options(cls, refs_string):
     """
     Converts the given CQL resource references string to a dictionary of
     attribute representer options.
     """
     try:
         return parse_refs(refs_string)
     except ParseException as err:
         raise ValueError('Refs string has errors. %s' % err)
Exemple #4
0
 def make_refs_options(cls, refs_string):
     """
     Converts the given CQL resource references string to a dictionary of
     attribute representer options.
     """
     try:
         return parse_refs(refs_string)
     except ParseException as err:
         raise ValueError('Refs string has errors. %s' % err)