The keyword __object__xmethods__ is used to declare methods, you can
specify it like that:
# --
# Copyright (C) CEA, EDF
# Author : Erwan ADAM (CEA)
# --
import unittest
from xdata import *
class A(XObject):
__object__xmethods__ = [
XMethod("run",
in_xattributes = XAttribute("value", xtype=XString(into=["Castem", "PorFlow"])),
out_xtype = XString(),
)
]
def run(self, value):
return value
pass
class TestCase(unittest.TestCase):
def test(self):
a = A()
self.failUnlessEqual(a.run('CASTEM'), "Castem")
return
pass
if __name__ == '__main__':
unittest.main()
pass