当前位置: 首页>>代码示例>>Python>>正文


Python DataHandler.get_xml方法代码示例

本文整理汇总了Python中mgi.tests.DataHandler.get_xml方法的典型用法代码示例。如果您正苦于以下问题:Python DataHandler.get_xml方法的具体用法?Python DataHandler.get_xml怎么用?Python DataHandler.get_xml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mgi.tests.DataHandler的用法示例。


在下文中一共展示了DataHandler.get_xml方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ParserReloadSimpleContentTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserReloadSimpleContentTestSuite(TestCase):
    """
    """

    def setUp(self):
        simple_content_data = join('utils', 'XSDParser', 'tests', 'data', 'parser', 'simple_content')
        self.simple_content_data_handler = DataHandler(simple_content_data)

        self.maxDiff = None

        self.request = HttpRequest()
        engine = import_module('django.contrib.sessions.backends.db')
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.request.session['curate_edit'] = True  # Data edition
        self.request.session['nb_html_tags'] = 0
        self.request.session['mapTagID'] = {}
        self.request.session['nbChoicesID'] = 0
        self.request.session['keys'] = {}
        self.request.session['keyrefs'] = {}

        # set default namespace
        self.namespace = {
            'xs': SCHEMA_NAMESPACE
        }
        self.request.session['defaultPrefix'] = 'xs'
        self.request.session['namespaces'] = self.namespace

        from utils.XSDParser import parser
        from curate.ajax import load_config
        parser.load_config(self.request, load_config())

    def test_restriction(self):
        xsd_files = join('restriction', 'basic')

        xsd_tree = self.simple_content_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:complexType/xs:simpleContent', namespaces=self.namespace)[0]

        xml_tree = self.simple_content_data_handler.get_xml(xsd_files)

        result_string = generate_simple_content(self.request, xsd_element, xsd_tree, full_path='/root',
                                                default_value='child0', edit_data_tree=xml_tree)

        expected_element = self.simple_content_data_handler.get_json(xsd_files + '.reload')
        self.assertDictEqual(result_string[1], expected_element)

    def test_extension(self):
        xsd_files = join('extension', 'basic')
        xsd_tree = self.simple_content_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:complexType/xs:simpleContent', namespaces=self.namespace)[0]

        xml_tree = self.simple_content_data_handler.get_xml(xsd_files)
        xml_value = xml_tree.xpath("/root", namespaces=self.namespace)[0].text

        result_string = generate_simple_content(self.request, xsd_element, xsd_tree, full_path='/root',
                                                default_value=xml_value, edit_data_tree=xml_tree)

        expected_element = self.simple_content_data_handler.get_json(xsd_files + '.reload')
        self.assertDictEqual(result_string[1], expected_element)
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:62,代码来源:test_simple_content.py

示例2: ParserReloadElementTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserReloadElementTestSuite(TestCase):
    """
    """

    def setUp(self):
        element_data = join('utils', 'XSDParser', 'tests', 'data', 'parser', 'element')
        self.element_data_handler = DataHandler(element_data)

        self.request = HttpRequest()
        engine = import_module('django.contrib.sessions.backends.db')
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.maxDiff = None

        self.request.session['curate_edit'] = False  # Data edition
        self.request.session['nb_html_tags'] = 0
        self.request.session['mapTagID'] = {}
        self.request.session['nbChoicesID'] = 0

        # set default namespace
        namespace = "http://www.w3.org/2001/XMLSchema"
        self.namespace = "{" + namespace + "}"
        self.request.session['defaultPrefix'] = 'xs'
        self.request.session['namespaces'] = {'xs': namespace}

        from utils.XSDParser import parser
        from curate.ajax import load_config
        parser.load_config(self.request, load_config())

    def test_reload_simple_type_basic(self):
        xsd_files = join('simple_type', 'basic')
        xsd_tree = self.element_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:element', namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.element_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))

        result_string = generate_element(self.request, xsd_element, xsd_tree, full_path='',
                                         edit_data_tree=edit_data_tree)

        expected_element = self.element_data_handler.get_json(xsd_files + '.reload')

        self.assertDictEqual(result_string[1], expected_element)

        # result_html = etree.fromstring(result_string[0])
        # expected_html = self.element_data_handler.get_html(xsd_files + '.reload')
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    def test_reload_simple_type_unbounded(self):
        xsd_files = join('simple_type', 'unbounded')
        xsd_tree = self.element_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:complexType/xs:sequence/xs:element',
                                     namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.element_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))

        result_string = generate_element(self.request, xsd_element, xsd_tree, full_path='/root',
                                         edit_data_tree=edit_data_tree)

        expected_element = self.element_data_handler.get_json(xsd_files + '.reload')

        self.assertDictEqual(result_string[1], expected_element)

        # result_html = etree.fromstring(result_string[0])
        # expected_html = self.element_data_handler.get_html(xsd_files + '.reload')
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    def test_reload_complex_type_basic(self):
        xsd_files = join('complex_type', 'basic')
        xsd_tree = self.element_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:element', namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.element_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))

        result_string = generate_element(self.request, xsd_element, xsd_tree, full_path='',
#.........这里部分代码省略.........
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:103,代码来源:test_element.py

示例3: ParserReloadSimpleTypeTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserReloadSimpleTypeTestSuite(TestCase):
    """
    """

    def setUp(self):
        simple_type_data = join('curate', 'tests', 'data', 'parser', 'simple_type')
        self.simple_type_data_handler = DataHandler(simple_type_data)

        self.maxDiff = None

        self.request = HttpRequest()
        engine = import_module('django.contrib.sessions.backends.db')
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.request.session['curate_edit'] = False  # Data edition
        self.request.session['nb_html_tags'] = 0
        self.request.session['mapTagID'] = {}
        self.request.session['nbChoicesID'] = 0
        self.request.session['implicit_extension'] = True

        # set default namespace
        namespace = "http://www.w3.org/2001/XMLSchema"
        self.namespace = "{" + namespace + "}"
        self.request.session['defaultPrefix'] = 'xs'
        self.request.session['namespaces'] = {'xs': namespace}

    def test_reload_restriction(self):
        # FIXME relaod restriction doesn't work
        xsd_files = join('restriction', 'basic')
        xsd_tree = self.simple_type_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:simpleType', namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.simple_type_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        xml_value = xml_tree.xpath("/root", namespaces=self.request.session['namespaces'])[0].text

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))

        result_string = generate_simple_type(self.request, xsd_element, xsd_tree, full_path='/root',
                                             default_value=xml_value, edit_data_tree=edit_data_tree)
        # print result_string

        expected_dict = self.simple_type_data_handler.get_json(xsd_files + '.reload')

        self.assertDictEqual(result_string[1], expected_dict)

    def test_reload_list(self):
        # FIXME list reload is not working
        xsd_files = join('list', 'basic')
        xsd_tree = self.simple_type_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:simpleType', namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.simple_type_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))
        result_string = generate_simple_type(self.request, xsd_element, xsd_tree, full_path='/root',
                                             edit_data_tree=edit_data_tree)
        # print result_string

        expected_dict = self.simple_type_data_handler.get_json(xsd_files + '.reload')

        self.assertDictEqual(result_string[1], expected_dict)
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:77,代码来源:test_simple_type.py

示例4: ParserReloadSequenceTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserReloadSequenceTestSuite(TestCase):
    """
    """

    def setUp(self):
        sequence_data = join('curate', 'tests', 'data', 'parser', 'sequence')
        self.sequence_data_handler = DataHandler(sequence_data)

        self.maxDiff = None

        self.request = HttpRequest()
        engine = import_module('django.contrib.sessions.backends.db')
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.request.session['curate_edit'] = False  # Data edition
        self.request.session['nb_html_tags'] = 0
        self.request.session['mapTagID'] = {}
        self.request.session['nbChoicesID'] = 0

        # set default namespace
        namespace = "http://www.w3.org/2001/XMLSchema"
        self.namespace = "{" + namespace + "}"
        self.request.session['defaultPrefix'] = 'xs'
        self.request.session['namespaces'] = {'xs': namespace}

    def test_reload_element_basic(self):
        xsd_files = join('element', 'basic')
        xsd_tree = self.sequence_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:complexType/xs:sequence',
                                     namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.sequence_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))
        result_string = generate_sequence(self.request, xsd_element, xsd_tree, full_path='/root',
                                          edit_data_tree=edit_data_tree)
        # print result_string

        expected_element = self.sequence_data_handler.get_json(xsd_files + '.reload')
        self.assertDictEqual(result_string[1], expected_element)

        # result_html = etree.fromstring(result_string[0])
        # expected_html = self.sequence_data_handler.get_html(xsd_files + '.reload')
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    def test_reload_element_unbounded(self):
        # fixme correct bug
        xsd_files = join('element', 'unbounded')
        xsd_tree = self.sequence_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:complexType/xs:sequence',
                                     namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.sequence_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))
        result_string = generate_sequence(self.request, xsd_element, xsd_tree, full_path='/root',
                                          edit_data_tree=edit_data_tree)
        # print result_string

        expected_element = self.sequence_data_handler.get_json(xsd_files + '.reload')

        self.assertDictEqual(result_string[1], expected_element)

        # result_html = etree.fromstring(result_string[0])
        # expected_html = self.sequence_data_handler.get_html(xsd_files + '.reload')
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    # fixme implement groups
    # def test_reload_group_basic(self):
    #     xsd_files = join('element', 'basic')
    #     xsd_tree = self.sequence_data_handler.get_xsd(xsd_files)
    #     xsd_element = xsd_tree.xpath('/schema/complexType/sequence')[0]
    #
    #     self.request.session['curate_edit'] = True
    #
    #     xml_tree = self.sequence_data_handler.get_xml(xsd_files)
    #     xml_data = etree.tostring(xml_tree)
    #
    #     clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
    #     etree.set_default_parser(parser=clean_parser)
    #     # load the XML tree from the text
    #     edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))
    #     result_string = generate_sequence(self.request, xsd_element, xsd_tree, '', full_path='/root',
    #                                    edit_data_tree=edit_data_tree)
    #     print result_string
#.........这里部分代码省略.........
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:103,代码来源:test_sequence.py

示例5: ParserReloadRestrictionTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserReloadRestrictionTestSuite(TestCase):
    """
    """

    def setUp(self):
        restriction_data = join('utils', 'XSDParser', 'tests', 'data', 'parser', 'restriction')
        self.restriction_data_handler = DataHandler(restriction_data)

        self.request = HttpRequest()
        engine = import_module('django.contrib.sessions.backends.db')
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.maxDiff = None

        self.request.session['curate_edit'] = True  # Data edition
        self.request.session['nb_html_tags'] = 0
        self.request.session['mapTagID'] = {}
        self.request.session['nbChoicesID'] = 0

        # set default namespace
        self.namespace = {
            'xs': SCHEMA_NAMESPACE
        }
        self.request.session['defaultPrefix'] = 'xs'
        self.request.session['namespaces'] = self.namespace

        self.xml_xpath = '/root'

        from utils.XSDParser import parser
        from curate.ajax import load_config
        parser.load_config(self.request, load_config())

    def test_enumeration(self):
        xsd_files = join('enumeration', 'basic')
        xsd_tree = self.restriction_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:simpleType/xs:restriction',
                                     namespaces=self.namespace)[0]

        xml_tree = self.restriction_data_handler.get_xml(xsd_files)
        # xml_data = etree.tostring(xml_tree)

        xml_data_value = xml_tree.xpath(self.xml_xpath)[0].text

        # clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        # etree.set_default_parser(parser=clean_parser)

        # load the XML tree from the text
        # edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))
        result_string = generate_restriction(self.request, xsd_element, xsd_tree, full_path=self.xml_xpath,
                                             edit_data_tree=xml_tree, default_value=xml_data_value)

        expected_element = self.restriction_data_handler.get_json(join('enumeration', 'reload'))

        self.assertDictEqual(result_string[1], expected_element)

    def test_simple_type(self):
        xsd_files = join('simple_type', 'basic')
        xsd_tree = self.restriction_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:simpleType/xs:restriction',
                                     namespaces=self.namespace)[0]

        xml_tree = self.restriction_data_handler.get_xml(xsd_files)
        xml_data_value = xml_tree.xpath(self.xml_xpath)[0].text

        result_string = generate_restriction(self.request, xsd_element, xsd_tree, full_path=self.xml_xpath,
                                             edit_data_tree=xml_tree, default_value=xml_data_value)

        expected_element = self.restriction_data_handler.get_json(join('simple_type', 'reload'))

        self.assertDictEqual(result_string[1], expected_element)
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:73,代码来源:test_restriction.py

示例6: ParserReloadComplexContentTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserReloadComplexContentTestSuite(TestCase):
    """
    """
    # FIXME restriction for complexContent are not working

    def setUp(self):
        extension_data = join('curate', 'tests', 'data', 'parser', 'complex_content')
        self.extension_data_handler = DataHandler(extension_data)

        self.maxDiff = None

        self.request = HttpRequest()
        engine = import_module('django.contrib.sessions.backends.db')
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.request.session['curate_edit'] = False  # Data edition
        self.request.session['nb_html_tags'] = 0
        self.request.session['mapTagID'] = {}
        self.request.session['nbChoicesID'] = 0

        # set default namespace
        namespace = "http://www.w3.org/2001/XMLSchema"
        self.namespace = "{" + namespace + "}"
        self.request.session['defaultPrefix'] = 'xs'
        self.request.session['namespaces'] = {'xs': namespace}

    def test_reload_restriction(self):
        xsd_files = join('restriction', 'basic')
        xsd_tree = self.extension_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:element/xs:complexType/xs:complexContent',
                                     namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.extension_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))

        result_string = generate_complex_content(self.request, xsd_element, xsd_tree, full_path='/root',
                                                 edit_data_tree=edit_data_tree)
        # print result_string
        # result_string = '<div>' + result_string + '</div>'

        expected_dict = self.extension_data_handler.get_json(xsd_files + '.reload')

        self.assertDictEqual(result_string[1], expected_dict)

        # result_string = '<div>' + result_string[0] + '</div>'
        # result_html = etree.fromstring(result_string[0])
        # expected_html = self.extension_data_handler.get_html(xsd_files + '.reload')
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    def test_reload_extension(self):
        xsd_files = join('extension', 'basic')
        xsd_tree = self.extension_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:element/xs:complexType/xs:complexContent',
                                     namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.extension_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))

        result_string = generate_complex_content(self.request, xsd_element, xsd_tree, full_path='/root',
                                                 edit_data_tree=edit_data_tree)
        # print result_string
        # result_string = '<div>' + result_string + '</div>'

        expected_dict = self.extension_data_handler.get_json(xsd_files + '.reload')

        self.assertDictEqual(result_string[1], expected_dict)
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:84,代码来源:test_complex_content.py

示例7: ParserLookupOccursTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserLookupOccursTestSuite(TestCase):
    """
    """

    def setUp(self):
        occurs_data = join("utils", "XSDParser", "tests", "data", "parser", "utils", "occurs")
        self.occurs_data_handler = DataHandler(occurs_data)

        self.request = HttpRequest()
        engine = import_module("django.contrib.sessions.backends.db")
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.request.session["curate_edit"] = False  # Data edition
        self.request.session["nb_html_tags"] = 0
        self.request.session["mapTagID"] = {}
        self.request.session["nbChoicesID"] = 0

        # set default namespace
        namespace = "http://www.w3.org/2001/XMLSchema"
        self.request.session["defaultPrefix"] = "xs"
        self.request.session["namespaces"] = {"xs": namespace}

        self.xml_xpath = "/root"

        self.document_schema = self.occurs_data_handler.get_xsd("document")
        # self.document_schema = etree.ElementTree(document_schema)

        sequence_xpath = "/xs:schema/xs:element/xs:complexType/xs:sequence"
        self.sequence = self.document_schema.xpath(sequence_xpath, namespaces=self.request.session["namespaces"])[0]

    def test_reload_compliant_element(self):

        compliant_xml = self.occurs_data_handler.get_xml("compliant")

        occurences = lookup_occurs(self.sequence, self.document_schema, self.xml_xpath, compliant_xml)

        self.assertEqual(len(occurences), 3)

        occ0_expected_xml = self.occurs_data_handler.get_xml("item0")
        occ1_expected_xml = self.occurs_data_handler.get_xml("item1")
        occ2_expected_xml = self.occurs_data_handler.get_xml("item2")

        self.assertTrue(are_equals(occurences[0], occ0_expected_xml))
        self.assertTrue(are_equals(occurences[1], occ1_expected_xml))
        self.assertTrue(are_equals(occurences[2], occ2_expected_xml))

    def test_reload_noncompliant_element(self):
        noncompliant_xml = self.occurs_data_handler.get_xml("noncompliant")

        occurences = lookup_occurs(self.sequence, self.document_schema, self.xml_xpath, noncompliant_xml)

        self.assertEqual(len(occurences), 6)

        occ0_expected_xml = self.occurs_data_handler.get_xml("item0")
        occ1_expected_xml = self.occurs_data_handler.get_xml("item1")
        occ2_expected_xml = self.occurs_data_handler.get_xml("item2")
        occ3_expected_xml = self.occurs_data_handler.get_xml("item3")
        occ4_expected_xml = self.occurs_data_handler.get_xml("item4")
        occ5_expected_xml = self.occurs_data_handler.get_xml("item5")

        self.assertTrue(are_equals(occurences[0], occ0_expected_xml))
        self.assertTrue(are_equals(occurences[1], occ1_expected_xml))
        self.assertTrue(are_equals(occurences[2], occ2_expected_xml))
        self.assertTrue(are_equals(occurences[3], occ3_expected_xml))
        self.assertTrue(are_equals(occurences[4], occ4_expected_xml))
        self.assertTrue(are_equals(occurences[5], occ5_expected_xml))
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:69,代码来源:test_utils.py

示例8: ParserGetXmlElementDataTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserGetXmlElementDataTestSuite(TestCase):
    """
    """

    def setUp(self):
        xml_element_data = join("utils", "XSDParser", "tests", "data", "parser", "utils", "xml_data")
        self.xml_element_data_handler = DataHandler(xml_element_data)

        self.namespace = {"xs": SCHEMA_NAMESPACE}

    def test_element_xml_text(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("element", "simple"))

        element_root_xpath = "/xs:schema/xs:element"
        element_root = xml_schema.xpath(element_root_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("element", "simple"))

        reload_data = get_xml_element_data(element_root, xml_element)
        self.assertEqual(reload_data, "string")

    def test_element_xml_branch(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("element", "complex"))

        element_root_xpath = "/xs:schema/xs:element"
        element_root = xml_schema.xpath(element_root_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("element", "complex"))

        reload_data = get_xml_element_data(element_root, xml_element)
        self.assertEqual(reload_data, etree.tostring(xml_element))

    def test_attribute(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("attribute", "schema"))

        attribute_xpath = "/xs:schema/xs:element/xs:complexType/xs:attribute"
        attribute = xml_schema.xpath(attribute_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("attribute", "instance"))
        xml_element_attrib = xml_element.attrib["id"]

        reload_data = get_xml_element_data(attribute, xml_element_attrib)
        self.assertEqual(reload_data, "attr0")

    def test_complex_type_xml_empty(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("complex_type", "schema"))

        complex_type_xpath = "/xs:schema/xs:complexType"
        complex_type = xml_schema.xpath(complex_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("complex_type", "empty"))

        reload_data = get_xml_element_data(complex_type, xml_element)
        self.assertEqual(reload_data, "")

    def test_complex_type_xml_branch(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("complex_type", "schema"))

        complex_type_xpath = "/xs:schema/xs:complexType"
        complex_type = xml_schema.xpath(complex_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("complex_type", "filled"))

        reload_data = get_xml_element_data(complex_type, xml_element)
        self.assertEqual(reload_data, etree.tostring(xml_element))

    def test_simple_type_xml_text(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("simple_type", "schema"))

        simple_type_xpath = "/xs:schema/xs:simpleType"
        simple_type = xml_schema.xpath(simple_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("simple_type", "filled"))

        reload_data = get_xml_element_data(simple_type, xml_element)
        self.assertEqual(reload_data, "child0")

    def test_simple_type_empty(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join("simple_type", "schema"))

        simple_type_xpath = "/xs:schema/xs:simpleType"
        simple_type = xml_schema.xpath(simple_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join("simple_type", "empty"))

        reload_data = get_xml_element_data(simple_type, xml_element)
        self.assertEqual(reload_data, "")
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:89,代码来源:test_utils.py

示例9: ParserReloadComplexTypeTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserReloadComplexTypeTestSuite(TestCase):
    """
    """

    def setUp(self):
        complex_type_data = join('utils', 'XSDParser', 'tests', 'data', 'parser', 'complex_type')
        self.complex_type_data_handler = DataHandler(complex_type_data)

        self.maxDiff = None

        self.request = HttpRequest()
        engine = import_module('django.contrib.sessions.backends.db')
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.request.session['curate_edit'] = False  # Data edition
        self.request.session['nb_html_tags'] = 0
        self.request.session['mapTagID'] = {}
        self.request.session['nbChoicesID'] = 0
        self.request.session['implicit_extension'] = True
        self.request.session['keys'] = {}
        self.request.session['keyrefs'] = {}

        # set default namespace
        namespace = "http://www.w3.org/2001/XMLSchema"
        self.namespace = "{" + namespace + "}"
        self.request.session['defaultPrefix'] = 'xs'
        self.request.session['namespaces'] = {'xs': namespace}

        from utils.XSDParser import parser
        from curate.ajax import load_config
        parser.load_config(self.request, load_config())

    def test_reload_simple_content(self):
        xsd_files = join('simple_content', 'basic')
        xsd_tree = self.complex_type_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:complexType', namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.complex_type_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        xml_value = xml_tree.xpath("/root", namespaces=self.request.session['namespaces'])[0].text

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))
        result_string = generate_complex_type(self.request, xsd_element, xsd_tree, full_path='/root',
                                              default_value=xml_value, edit_data_tree=edit_data_tree)
        # print result_string

        expected_element = self.complex_type_data_handler.get_json(xsd_files + '.reload')

        self.assertDictEqual(result_string[1], expected_element)

        # result_html = etree.fromstring(result_string[0])
        # expected_html = self.complex_type_data_handler.get_html(xsd_files + '.reload')
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    def test_reload_complex_content(self):
        xsd_files = join('complex_content', 'basic')
        xsd_tree = self.complex_type_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:complexType', namespaces=self.request.session['namespaces'])[0]

        self.request.session['curate_edit'] = True

        xml_tree = self.complex_type_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))
        result_string = generate_complex_type(self.request, xsd_element, xsd_tree, full_path='/root',
                                              edit_data_tree=edit_data_tree)

        expected_element = self.complex_type_data_handler.get_json(xsd_files + '.reload')
        self.assertDictEqual(result_string[1], expected_element)

        # print result_string

        # result_html = etree.fromstring(result_string)
        # expected_html = self.complex_type_data_handler.get_html(xsd_files + '.reload')
        #
        # self.assertTrue(are_equals(result_html, expected_html))
    #
    # FIXME group not implemented
    # def test_reload_group(self):
    #     xsd_files = join('simple_content', 'basic')
    #     xsd_tree = self.complex_type_data_handler.get_xsd(xsd_files)
    #     xsd_element = xsd_tree.xpath('/schema/complexType')[0]
    #
    #     self.request.session['curate_edit'] = True
    #
    #     xml_tree = self.complex_type_data_handler.get_xml(xsd_files)
    #     xml_data = etree.tostring(xml_tree)
    #
#.........这里部分代码省略.........
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:103,代码来源:test_complex_type.py

示例10: ParserGetXmlElementDataTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserGetXmlElementDataTestSuite(TestCase):
    """
    """

    def setUp(self):
        xml_element_data = join('curate', 'tests', 'data', 'parser', 'utils', 'xml_data')
        self.xml_element_data_handler = DataHandler(xml_element_data)

        self.namespace = {
            'xs': SCHEMA_NAMESPACE
        }

    def test_element_xml_text(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join('element', 'simple'))

        element_root_xpath = '/xs:schema/xs:element'
        element_root = xml_schema.xpath(element_root_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join('element', 'simple'))

        reload_data = get_xml_element_data(element_root, xml_element)
        self.assertEqual(reload_data, 'string')

    def test_element_xml_branch(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join('element', 'complex'))

        element_root_xpath = '/xs:schema/xs:element'
        element_root = xml_schema.xpath(element_root_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join('element', 'complex'))

        reload_data = get_xml_element_data(element_root, xml_element)
        self.assertEqual(reload_data, etree.tostring(xml_element))

    def test_attribute(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join('attribute', 'schema'))

        attribute_xpath = '/xs:schema/xs:element/xs:complexType/xs:attribute'
        attribute = xml_schema.xpath(attribute_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join('attribute', 'instance'))
        xml_element_attrib = xml_element.attrib['id']

        reload_data = get_xml_element_data(attribute, xml_element_attrib)
        self.assertEqual(reload_data, 'attr0')

    def test_complex_type_xml_empty(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join('complex_type', 'schema'))

        complex_type_xpath = '/xs:schema/xs:complexType'
        complex_type = xml_schema.xpath(complex_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join('complex_type', 'empty'))

        reload_data = get_xml_element_data(complex_type, xml_element)
        self.assertEqual(reload_data, "")

    def test_complex_type_xml_branch(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join('complex_type', 'schema'))

        complex_type_xpath = '/xs:schema/xs:complexType'
        complex_type = xml_schema.xpath(complex_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join('complex_type', 'filled'))

        reload_data = get_xml_element_data(complex_type, xml_element)
        self.assertEqual(reload_data, etree.tostring(xml_element))

    def test_simple_type_xml_text(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join('simple_type', 'schema'))

        simple_type_xpath = '/xs:schema/xs:simpleType'
        simple_type = xml_schema.xpath(simple_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join('simple_type', 'filled'))

        reload_data = get_xml_element_data(simple_type, xml_element)
        self.assertEqual(reload_data, "child0")

    def test_simple_type_empty(self):
        xml_schema = self.xml_element_data_handler.get_xsd(join('simple_type', 'schema'))

        simple_type_xpath = '/xs:schema/xs:simpleType'
        simple_type = xml_schema.xpath(simple_type_xpath, namespaces=self.namespace)[0]

        xml_element = self.xml_element_data_handler.get_xml(join('simple_type', 'empty'))

        reload_data = get_xml_element_data(simple_type, xml_element)
        self.assertEqual(reload_data, "")
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:91,代码来源:test_utils.py

示例11: ParserLookupOccursTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserLookupOccursTestSuite(TestCase):
    """
    """

    def setUp(self):
        occurs_data = join('curate', 'tests', 'data', 'parser', 'utils', 'occurs')
        self.occurs_data_handler = DataHandler(occurs_data)

        self.request = HttpRequest()
        engine = import_module('django.contrib.sessions.backends.db')
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.request.session['curate_edit'] = False  # Data edition
        self.request.session['nb_html_tags'] = 0
        self.request.session['mapTagID'] = {}
        self.request.session['nbChoicesID'] = 0

        # set default namespace
        namespace = "http://www.w3.org/2001/XMLSchema"
        self.request.session['defaultPrefix'] = 'xs'
        self.request.session['namespaces'] = {'xs': namespace}

        self.xml_xpath = '/root'

        self.document_schema = self.occurs_data_handler.get_xsd('document')
        # self.document_schema = etree.ElementTree(document_schema)

        sequence_xpath = '/xs:schema/xs:element/xs:complexType/xs:sequence'
        self.sequence = self.document_schema.xpath(sequence_xpath, namespaces=self.request.session['namespaces'])[0]

    def test_reload_compliant_element(self):

        compliant_xml = self.occurs_data_handler.get_xml('compliant')

        occurences = lookup_occurs(self.sequence, self.document_schema, self.xml_xpath, compliant_xml)

        self.assertEqual(len(occurences), 3)

        occ0_expected_xml = self.occurs_data_handler.get_xml('item0')
        occ1_expected_xml = self.occurs_data_handler.get_xml('item1')
        occ2_expected_xml = self.occurs_data_handler.get_xml('item2')

        self.assertTrue(are_equals(occurences[0], occ0_expected_xml))
        self.assertTrue(are_equals(occurences[1], occ1_expected_xml))
        self.assertTrue(are_equals(occurences[2], occ2_expected_xml))

    def test_reload_noncompliant_element(self):
        noncompliant_xml = self.occurs_data_handler.get_xml('noncompliant')

        occurences = lookup_occurs(self.sequence, self.document_schema, self.xml_xpath, noncompliant_xml)

        self.assertEqual(len(occurences), 6)

        occ0_expected_xml = self.occurs_data_handler.get_xml('item0')
        occ1_expected_xml = self.occurs_data_handler.get_xml('item1')
        occ2_expected_xml = self.occurs_data_handler.get_xml('item2')
        occ3_expected_xml = self.occurs_data_handler.get_xml('item3')
        occ4_expected_xml = self.occurs_data_handler.get_xml('item4')
        occ5_expected_xml = self.occurs_data_handler.get_xml('item5')

        self.assertTrue(are_equals(occurences[0], occ0_expected_xml))
        self.assertTrue(are_equals(occurences[1], occ1_expected_xml))
        self.assertTrue(are_equals(occurences[2], occ2_expected_xml))
        self.assertTrue(are_equals(occurences[3], occ3_expected_xml))
        self.assertTrue(are_equals(occurences[4], occ4_expected_xml))
        self.assertTrue(are_equals(occurences[5], occ5_expected_xml))
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:69,代码来源:test_utils.py

示例12: ParserReloadExtensionTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]

#.........这里部分代码省略.........
    #     xsd_element = xsd_tree.xpath('/xs:schema/xs:element/xs:complexType/xs:complexContent/xs:extension',
    #                                  namespaces=self.request.session['namespaces'])[0]
    #
    #     self.request.session['curate_edit'] = True
    #
    #     xml_tree = self.extension_data_handler.get_xml(xsd_files)
    #     xml_data = etree.tostring(xml_tree)
    #
    #     clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
    #     etree.set_default_parser(parser=clean_parser)
    #     # load the XML tree from the text
    #     edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))
    #     result_string = generate_extension(self.request, xsd_element, xsd_tree, self.namespace, full_path='/test1',
    #                                        edit_data_tree=edit_data_tree)
    #     # print result_string
    #     # result_string = '<div>' + result_string + '</div>'
    #
    #     expected_dict = {}
    #
    #     self.assertDictEqual(result_string[1], expected_dict)
    #
    #     result_string = '<div>' + result_string[0] + '</div>'
    #     result_html = etree.fromstring(result_string)
    #     expected_html = self.extension_data_handler.get_html(xsd_files + '.reload')
    #
    #     self.assertTrue(are_equals(result_html, expected_html))

    def test_choice(self):
        xsd_files = join('choice', 'basic')
        xsd_tree = self.extension_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:element/xs:complexType/xs:complexContent/xs:extension',
                                     namespaces=self.session['namespaces'])[0]

        xml_tree = self.extension_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        xml_value = xml_tree.xpath('/test2', namespaces=self.session['namespaces'])[0].text

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)

        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))

        result_string = generate_extension(self.request, xsd_element, xsd_tree, full_path='/test2',
                                           default_value=xml_value, edit_data_tree=edit_data_tree)

        expected_dict = self.extension_data_handler.get_json(xsd_files+'.reload')

        self.assertDictEqual(result_string[1], expected_dict)

    def test_sequence(self):
        xsd_files = join('sequence', 'basic')
        xsd_tree = self.extension_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath('/xs:schema/xs:element/xs:complexType/xs:complexContent/xs:extension',
                                     namespaces=self.session['namespaces'])[0]

        xml_tree = self.extension_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        xml_value = ''

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode('utf-8')))
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:70,代码来源:test_extension.py

示例13: ParserReloadChoiceTestSuite

# 需要导入模块: from mgi.tests import DataHandler [as 别名]
# 或者: from mgi.tests.DataHandler import get_xml [as 别名]
class ParserReloadChoiceTestSuite(TestCase):
    """
    """

    def setUp(self):
        choice_data = join("utils", "XSDParser", "tests", "data", "parser", "choice")
        self.choice_data_handler = DataHandler(choice_data)

        self.maxDiff = None

        self.request = HttpRequest()
        engine = import_module("django.contrib.sessions.backends.db")
        session_key = None
        self.request.session = engine.SessionStore(session_key)

        self.request.session["curate_edit"] = False  # Data edition
        self.request.session["nb_html_tags"] = 0
        self.request.session["mapTagID"] = {}
        self.request.session["nbChoicesID"] = 0

        # set default namespace
        namespace = "http://www.w3.org/2001/XMLSchema"
        self.namespace = "{" + namespace + "}"
        self.request.session["defaultPrefix"] = "xs"
        self.request.session["namespaces"] = {"xs": namespace}

        from utils.XSDParser import parser
        from curate.ajax import load_config

        parser.load_config(self.request, load_config())

    def test_reload_element_basic(self):
        xsd_files = join("element", "basic")
        xsd_tree = self.choice_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath(
            "/xs:schema/xs:complexType/xs:choice", namespaces=self.request.session["namespaces"]
        )[0]

        self.request.session["curate_edit"] = True

        xml_tree = self.choice_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode("utf-8")))
        result_string = generate_choice(
            self.request, xsd_element, xsd_tree, full_path="/root", edit_data_tree=edit_data_tree
        )
        # print result_string

        expected_element = self.choice_data_handler.get_json(xsd_files + ".reload")

        self.assertDictEqual(result_string[1], expected_element)

        # result_html = etree.fromstring(result_string[0])
        # expected_html = self.choice_data_handler.get_html(xsd_files + '.reload')
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    def test_reload_element_unbounded(self):
        # FIXME correct the bug here
        xsd_files = join("element", "unbounded")
        xsd_tree = self.choice_data_handler.get_xsd(xsd_files)
        xsd_element = xsd_tree.xpath(
            "/xs:schema/xs:complexType/xs:choice", namespaces=self.request.session["namespaces"]
        )[0]

        self.request.session["curate_edit"] = True

        xml_tree = self.choice_data_handler.get_xml(xsd_files)
        xml_data = etree.tostring(xml_tree)

        clean_parser = etree.XMLParser(remove_blank_text=True, remove_comments=True, remove_pis=True)
        etree.set_default_parser(parser=clean_parser)
        # load the XML tree from the text
        edit_data_tree = etree.XML(str(xml_data.encode("utf-8")))
        result_string = generate_choice(
            self.request, xsd_element, xsd_tree, full_path="/root", edit_data_tree=edit_data_tree
        )
        # print result_string

        expected_element = self.choice_data_handler.get_json(xsd_files + ".reload")

        self.assertDictEqual(result_string[1], expected_element)

        # result_html = etree.fromstring(result_string[0])
        # expected_html = self.choice_data_handler.get_html(xsd_files + '.reload')
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    # TODO implement later
    # def test_reload_group_basic(self):
    #     xsd_files = join('element', 'basic')
    #     xsd_tree = self.choice_data_handler.get_xsd(xsd_files)
    #     xsd_element = xsd_tree.xpath('/schema/complexType/choice')[0]
    #
    #     self.request.session['curate_edit'] = True
    #
#.........这里部分代码省略.........
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:103,代码来源:test_choice.py


注:本文中的mgi.tests.DataHandler.get_xml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。