def testFormatDescription(self):
     dict_ = HandlebarDictGenerator(
         self._LoadJSON('ref_test.json')).Generate()
     self.assertEquals(_MakeLink('#type-type2', 'type2'),
                       _GetType(dict_, 'type1')['description'])
     self.assertEquals(
         'A %s, or %s' % (_MakeLink(
             '#type-type3', 'type3'), _MakeLink('#type-type2', 'type2')),
         _GetType(dict_, 'type2')['description'])
     self.assertEquals(
         '%s != %s' % (_MakeLink('other.html#type-type2', 'other.type2'),
                       _MakeLink('#type-type2', 'type2')),
         _GetType(dict_, 'type3')['description'])
Esempio n. 2
0
 def _LoadIdlAPI(self, api):
     idl = idl_parser.IDLParser().ParseData(api)
     generator = HandlebarDictGenerator(
         idl_schema.IDLSchema(idl).process()[0])
     return generator.Generate()
Esempio n. 3
0
 def _LoadJsonAPI(self, api):
     generator = HandlebarDictGenerator(
         json.loads(json_comment_eater.Nom(api),
                    object_pairs_hook=collections.OrderedDict)[0])
     return generator.Generate()
Esempio n. 4
0
 def _LoadJsonAPI(self, api):
   generator = HandlebarDictGenerator(
       json.loads(json_comment_eater.Nom(api))[0])
   return generator.Generate()
 def _GenerateTest(self, filename):
     expected_json = json.loads(self._ReadLocalFile('expected_' + filename))
     gen = HandlebarDictGenerator(self._LoadJSON(filename))
     self.assertEquals(expected_json, gen.Generate())
 def _GenerateTest(self, filename):
     expected_json = json.loads(self._ReadLocalFile('expected_' + filename))
     gen = HandlebarDictGenerator(
         json.loads(comment_eater.Nom(self._ReadLocalFile(filename)))[0])
     self.assertEquals(expected_json, gen.Generate())