def update(self): super(JsonCollectionCellMLCodegenNote, self).update() if self.language: self._jc_items = [keyvalue_to_itemdata( {self.language: self.content()} )] else: self._jc_links = self.generate_lang_links()
def test_keyvalue_to_itemdata(self): value = { 'foo': 'bar', 'key': 'value', } result = core.keyvalue_to_itemdata(value) self.assertEqual(result, {'data': [ { 'name': 'foo', 'value': 'bar', }, { 'name': 'key', 'value': 'value', } ]}) self.assertEqual(core.keyvalue_to_itemdata({}), {'data': []})
def update(self): super(JsonCollectionCmetaNote, self).update() self._jc_items = [keyvalue_to_itemdata(cmeta_note_dict((self.note)))]