• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tests.DataHandler类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ParserManageOccurencesTestSuite

class ParserManageOccurencesTestSuite(TestCase):
    """
    """

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

    def test_element_with_min_occurs_parsable(self):
        xsd_tree = self.occurs_data_handler.get_xsd('min_occurs_parsable')
        xsd_element = xsd_tree.getroot()

        (min_occ, max_occ) = manage_occurences(xsd_element)

        self.assertEqual(min_occ, 1)

    def test_element_with_max_occurs_unbounded(self):
        xsd_tree = self.occurs_data_handler.get_xsd('max_occurs_unbounded')
        xsd_element = xsd_tree.getroot()

        (min_occ, max_occ) = manage_occurences(xsd_element)

        self.assertEqual(max_occ, -1)

    def test_element_with_max_occurs_parsable(self):
        xsd_tree = self.occurs_data_handler.get_xsd('max_occurs_parsable')
        xsd_element = xsd_tree.getroot()

        (min_occ, max_occ) = manage_occurences(xsd_element)

        self.assertEqual(max_occ, 5)
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:31,代码来源:test_utils.py


示例2: ParserRemoveAnnotationTestSuite

class ParserRemoveAnnotationTestSuite(TestCase):
    """
    """

    def setUp(self):
        annotation_data = join('curate', 'tests', 'data', 'parser', 'utils', 'annotation')
        self.annotation_data_handler = DataHandler(annotation_data)

        self.namespaces = {
            'xs': SCHEMA_NAMESPACE
        }

        xsd_etree = self.annotation_data_handler.get_xsd('not_annot')

        self.xsd_xpath = '/xs:schema/xs:complexType/xs:sequence'
        self.expected_xsd = xsd_etree.xpath(self.xsd_xpath, namespaces=self.namespaces)[0]

    def test_annotation_is_removed(self):
        annotated_etree = self.annotation_data_handler.get_xsd('annot')
        # annotated_etree = etree.ElementTree(annotated_schema)

        annotated_element = annotated_etree.xpath(self.xsd_xpath, namespaces=self.namespaces)[0]

        remove_annotations(annotated_element)

        self.assertTrue(are_equals(annotated_element, self.expected_xsd))

    def test_no_annotation_no_change(self):
        not_annotated_etree = self.annotation_data_handler.get_xsd('not_annot')

        not_annotated_element = not_annotated_etree.xpath(self.xsd_xpath, namespaces=self.namespaces)[0]

        remove_annotations(not_annotated_element)

        self.assertTrue(are_equals(not_annotated_element, self.expected_xsd))
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:35,代码来源:test_utils.py


示例3: ParserManageOccurencesTestSuite

class ParserManageOccurencesTestSuite(TestCase):
    """
    """

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

    def test_element_with_min_occurs_parsable(self):
        xsd_tree = self.occurs_data_handler.get_xsd("min_occurs_parsable")
        xsd_element = xsd_tree.getroot()

        (min_occ, max_occ) = manage_occurences(xsd_element)

        self.assertEqual(min_occ, 1)

    def test_element_with_max_occurs_unbounded(self):
        xsd_tree = self.occurs_data_handler.get_xsd("max_occurs_unbounded")
        xsd_element = xsd_tree.getroot()

        (min_occ, max_occ) = manage_occurences(xsd_element)

        self.assertEqual(max_occ, -1)

    def test_element_with_max_occurs_parsable(self):
        xsd_tree = self.occurs_data_handler.get_xsd("max_occurs_parsable")
        xsd_element = xsd_tree.getroot()

        (min_occ, max_occ) = manage_occurences(xsd_element)

        self.assertEqual(max_occ, 5)
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:31,代码来源:test_utils.py


示例4: ParserRemoveAnnotationTestSuite

class ParserRemoveAnnotationTestSuite(TestCase):
    """
    """

    def setUp(self):
        annotation_data = join("utils", "XSDParser", "tests", "data", "parser", "utils", "annotation")
        self.annotation_data_handler = DataHandler(annotation_data)

        self.namespaces = {"xs": SCHEMA_NAMESPACE}

        xsd_etree = self.annotation_data_handler.get_xsd("not_annot")

        self.xsd_xpath = "/xs:schema/xs:complexType/xs:sequence"
        self.expected_xsd = xsd_etree.xpath(self.xsd_xpath, namespaces=self.namespaces)[0]

    def test_annotation_is_removed(self):
        annotated_etree = self.annotation_data_handler.get_xsd("annot")
        # annotated_etree = etree.ElementTree(annotated_schema)

        annotated_element = annotated_etree.xpath(self.xsd_xpath, namespaces=self.namespaces)[0]

        remove_annotations(annotated_element)

        self.assertTrue(are_equals(annotated_element, self.expected_xsd))

    def test_no_annotation_no_change(self):
        not_annotated_etree = self.annotation_data_handler.get_xsd("not_annot")

        not_annotated_element = not_annotated_etree.xpath(self.xsd_xpath, namespaces=self.namespaces)[0]

        remove_annotations(not_annotated_element)

        self.assertTrue(are_equals(not_annotated_element, self.expected_xsd))
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:33,代码来源:test_utils.py


示例5: ParserHasModuleTestSuite

class ParserHasModuleTestSuite(TestCase):
    """
    """

    def _save_module_to_db(self):
        # FIXME module is not saved in the right database
        module = Module()
        module.name = "registered_module"
        module.url = "registered_module"
        module.view = "registered_module"

        module.save()

    def setUp(self):
        # connect to test database
        # self.db_name = "mgi_test"
        # disconnect()
        # connect(self.db_name, port=27018)

        module_data = join("utils", "XSDParser", "tests", "data", "parser", "utils", "modules")
        self.module_data_handler = DataHandler(module_data)

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

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

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

    def test_element_is_module_registered(self):
        # expect true
        self._save_module_to_db()

        xsd_tree = self.module_data_handler.get_xsd("registered_module")
        xsd_element = xsd_tree.getroot()

        has_module_result = has_module(self.request, xsd_element)

        self.assertTrue(has_module_result)

    def test_element_is_module_not_registered(self):
        # expect false
        xsd_tree = self.module_data_handler.get_xsd("unregistered_module")
        xsd_element = xsd_tree.getroot()

        has_module_result = has_module(self.request, xsd_element)

        self.assertFalse(has_module_result)

    def test_element_is_not_module(self):
        # expect false
        xsd_tree = self.module_data_handler.get_xsd("no_module")
        xsd_element = xsd_tree.getroot()

        has_module_result = has_module(self.request, xsd_element)

        self.assertFalse(has_module_result)
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:60,代码来源:test_utils.py


示例6: setUp

    def setUp(self):
        xsd_files_path = join(XSD_FILES_PATH, 'choice')
        self.xsd_handler = DataHandler(xsd_files_path)

        html_files_path = join(HTML_FILES_PATH, 'choice')
        self.html_handler = DataHandler(html_files_path)

        engine = import_module('django.contrib.sessions.backends.db')
        session = engine.SessionStore()
        session.save()

        self.client.cookies['sessionid'] = session.session_key

        session['curate_edit'] = False

        form_data = FormData()
        form_data.name = ''
        form_data.user = ''
        form_data.template = ''

        form_data.save()

        session['curateFormData'] = str(form_data.pk)
        session['nb_html_tags'] = 0
        session['implicit_extension'] = True
        session['mapTagID'] = {}
        session['nbChoicesID'] = 0
        session.save()
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:28,代码来源:test_choice.py


示例7: ParserCreateComplexContentTestSuite

class ParserCreateComplexContentTestSuite(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_create_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]

        result_string = generate_complex_content(self.request, xsd_element, xsd_tree, full_path='')
        # print result_string

        expected_dict = self.extension_data_handler.get_json(xsd_files)

        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)
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    def test_create_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]

        result_string = generate_complex_content(self.request, xsd_element, xsd_tree, full_path='')
        # print result_string

        expected_dict = self.extension_data_handler.get_json(xsd_files)

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


示例8: ParserCreateSimpleTypeTestSuite

class ParserCreateSimpleTypeTestSuite(TestCase):
    """
    """

    def setUp(self):
        simple_type_data = join('utils', 'XSDParser', '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}

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

    def test_create_restriction(self):
        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]

        result_string = generate_simple_type(self.request, xsd_element, xsd_tree, full_path='')
        # print result_string

        expected_dict = self.simple_type_data_handler.get_json(xsd_files)

        self.assertDictEqual(result_string[1], expected_dict)

        # result_html = etree.fromstring(result_string[0])
        # expected_html = self.simple_type_data_handler.get_html(xsd_files)
        #
        # self.assertTrue(are_equals(result_html, expected_html))

    def test_create_list(self):
        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]

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

        expected_dict = self.simple_type_data_handler.get_json(xsd_files)
        self.assertDictEqual(result_string[1], expected_dict)
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:57,代码来源:test_simple_type.py


示例9: ParserCreateRestrictionTestSuite

class ParserCreateRestrictionTestSuite(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'] = False  # 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

        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]

        result_string = generate_restriction(self.request, xsd_element, xsd_tree)
        # print result_string

        expected_element = self.restriction_data_handler.get_json(xsd_files)
        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]

        result_string = generate_restriction(self.request, xsd_element, xsd_tree)
        # print result_string

        expected_element = self.restriction_data_handler.get_json(xsd_files)

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


示例10: ChoiceCreateSchemaTestSuite

class ChoiceCreateSchemaTestSuite(SimpleTestCase):
    """
    """

    def setUp(self):
        xsd_files_path = join(XSD_FILES_PATH, 'choice')
        self.xsd_handler = DataHandler(xsd_files_path)

        html_files_path = join(HTML_FILES_PATH, 'choice')
        self.html_handler = DataHandler(html_files_path)

        engine = import_module('django.contrib.sessions.backends.db')
        session = engine.SessionStore()
        session.save()

        self.client.cookies['sessionid'] = session.session_key

        session['curate_edit'] = False

        form_data = FormData()
        form_data.name = ''
        form_data.user = ''
        form_data.template = ''

        form_data.save()

        session['curateFormData'] = str(form_data.pk)
        session['nb_html_tags'] = 0
        session['implicit_extension'] = True
        session['mapTagID'] = {}
        session['nbChoicesID'] = 0
        session.save()

    # def test_any_basic(self):
    #     pass
    #
    # def test_any_unbounded(self):
    #     pass

    def test_choice_basic(self):
        file_path = join('choice', 'basic')

        xsd_data = self.xsd_handler.get_xsd(file_path)

        session = self.client.session
        session['xmlDocTree'] = etree.tostring(xsd_data)
        session.save()

        result = retrieve_rendered_form(self.client)
        expected_result = self.html_handler.get_html(file_path)

        self.assertTrue(are_equals(result[1], expected_result))
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:52,代码来源:test_choice.py


示例11: ParserHasModuleTestSuite

class ParserHasModuleTestSuite(TestCase):
    """
    """

    def _save_module_to_db(self):
        # FIXME module is not saved in the right database
        module = Module()
        module.name = 'registered_module'
        module.url = 'registered_module'
        module.view = 'registered_module'

        module.save()

    def setUp(self):
        # connect to test database
        # self.db_name = "mgi_test"
        # disconnect()
        # connect(self.db_name, port=27018)

        module_data = join('curate', 'tests', 'data', 'parser', 'utils', 'modules')
        self.module_data_handler = DataHandler(module_data)

    def test_element_is_module_registered(self):
        # expect true
        self._save_module_to_db()

        xsd_tree = self.module_data_handler.get_xsd('registered_module')
        xsd_element = xsd_tree.getroot()

        has_module_result = has_module(xsd_element)

        self.assertTrue(has_module_result)

    def test_element_is_module_not_registered(self):
        # expect false
        xsd_tree = self.module_data_handler.get_xsd('unregistered_module')
        xsd_element = xsd_tree.getroot()

        has_module_result = has_module(xsd_element)

        self.assertFalse(has_module_result)

    def test_element_is_not_module(self):
        # expect false
        xsd_tree = self.module_data_handler.get_xsd('no_module')
        xsd_element = xsd_tree.getroot()

        has_module_result = has_module(xsd_element)

        self.assertFalse(has_module_result)
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:50,代码来源:test_utils.py


示例12: ParserCreateSimpleContentTestSuite

class ParserCreateSimpleContentTestSuite(TestCase):
    """
    """

    def setUp(self):
        simple_content_data = join('curate', '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'] = False  # 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

    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]

        result_string = generate_simple_content(self.request, xsd_element, xsd_tree)
        expected_element = self.simple_content_data_handler.get_json(xsd_files)

        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]

        result_string = generate_simple_content(self.request, xsd_element, xsd_tree)
        expected_element = self.simple_content_data_handler.get_json(xsd_files)

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


示例13: setUp

    def setUp(self):
        extension_data = join('utils', 'XSDParser', 'tests', 'data', 'parser', 'extension')
        self.extension_data_handler = DataHandler(extension_data)

        self.maxDiff = None

        engine = import_module(settings.SESSION_ENGINE)
        store = engine.SessionStore()

        store['curate_edit'] = False  # Data edition
        store['nb_html_tags'] = 0
        store['mapTagID'] = {}
        store['nbChoicesID'] = 0
        store['keys'] = {}
        store['keyrefs'] = {}

        # set default namespace
        self.namespace = "{" + SCHEMA_NAMESPACE + "}"
        store['defaultPrefix'] = 'xs'
        store['namespaces'] = {'xs': SCHEMA_NAMESPACE}

        store.save()
        self.session = store

        self.client.cookies[settings.SESSION_COOKIE_NAME] = store.session_key

        self.request = HttpRequest()
        self.request.session = self.session

        from utils.XSDParser import parser
        from curate.ajax import load_config
        parser.load_config(self.request, load_config())
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:32,代码来源:test_extension.py


示例14: setUp

    def setUp(self):
        subnodes_data = join('curate', 'tests', 'data', 'parser', 'utils', 'xpath')
        self.subnodes_data_handler = DataHandler(subnodes_data)

        self.namespace = {
            'xs': SCHEMA_NAMESPACE
        }
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:7,代码来源:test_utils.py


示例15: setUp

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

        self.maxDiff = None

        engine = import_module(settings.SESSION_ENGINE)
        store = engine.SessionStore()

        # Session dictionary update
        store['curate_edit'] = True  # Data edition
        store['nb_html_tags'] = 0
        store['mapTagID'] = {}
        store['nbChoicesID'] = 0
        store['keys'] = {}
        store['keyrefs'] = {}

        # set default namespace
        self.namespace = "{" + SCHEMA_NAMESPACE + "}"
        store['defaultPrefix'] = 'xs'
        store['namespaces'] = {'xs': SCHEMA_NAMESPACE}

        store.save()
        self.session = store

        self.request = HttpRequest()
        self.request.session = self.session
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:27,代码来源:test_extension.py


示例16: setUp

    def setUp(self):
        self.defaultPrefix = "xsd"

        xml_element_data = join("utils", "XSDParser", "tests", "data", "parser", "utils", "element_type")
        self.xml_element_data_handler = DataHandler(xml_element_data)

        self.namespace = {"xs": SCHEMA_NAMESPACE}
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:7,代码来源:test_utils.py


示例17: setUp

    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())
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:25,代码来源:test_element.py


示例18: setUp

    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())
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:28,代码来源:test_simple_content.py


示例19: setUp

    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())
开发者ID:usnistgov,项目名称:MaterialsResourceRegistry,代码行数:26,代码来源:test_choice.py


示例20: setUp

    def setUp(self):
        buttons_data = join('curate', 'tests', 'data', 'parser', 'utils', 'buttons')
        self.buttons_data_handler = DataHandler(buttons_data)

        self.types_generator = VariableTypesGenerator()
        self.default_tag_id = 'string'

        self.renderer = HtmlRenderer()
开发者ID:pdessauw,项目名称:MaterialsResourceRegistry,代码行数:8,代码来源:test_render_buttons.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python mgi_utils.date函数代码示例发布时间:2022-05-27
下一篇:
Python models.XMLdata类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap