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


Python StetlTestCase.get_section方法代码示例

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


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

示例1: test_execute

# 需要导入模块: from tests.stetl_test_case import StetlTestCase [as 别名]
# 或者: from tests.stetl_test_case.StetlTestCase import get_section [as 别名]
    def test_execute(self):
        chain = StetlTestCase.get_chain(self.etl)
        chain.run()

        # Check if temp file exists
        section = StetlTestCase.get_section(chain, 1)
        file_path = self.etl.configdict.get(section, 'file_path')
        self.assertTrue(os.path.exists(file_path))
        
        # Compare temp file to input file byte by byte
        section = StetlTestCase.get_section(chain)
        orig_file_path = self.etl.configdict.get(section, 'file_path')
        with open(file_path, 'rb') as f:
            file = f.read()
        with open(orig_file_path, 'rb') as f:
            orig_file = f.read()
        self.assertEqual(file, orig_file)
        
        # Remove temp file
        os.remove(file_path)
开发者ID:fsteggink,项目名称:stetl,代码行数:22,代码来源:test_packet_writer.py

示例2: test_execute

# 需要导入模块: from tests.stetl_test_case import StetlTestCase [as 别名]
# 或者: from tests.stetl_test_case.StetlTestCase import get_section [as 别名]
 def test_execute(self):
     # Read content of input file
     chain = StetlTestCase.get_chain(self.etl)
     section = StetlTestCase.get_section(chain)
     fn = self.etl.configdict.get(section, 'file_path')
     with open(fn, 'r') as f:
         contents = f.read()
     
     self.etl.run()
     
     self.assertGreater(len(sys.stdout.getvalue()), 0)
     # Assert includes last linebreak from stdout, due to print function
     self.assertEqual(sys.stdout.getvalue(), contents + '\n')
开发者ID:geopython,项目名称:stetl,代码行数:15,代码来源:test_standard_output.py

示例3: test_execute

# 需要导入模块: from tests.stetl_test_case import StetlTestCase [as 别名]
# 或者: from tests.stetl_test_case.StetlTestCase import get_section [as 别名]
    def test_execute(self, mock_tx_execute):
        # Read content of input file
        chain = StetlTestCase.get_chain(self.etl)
        section = StetlTestCase.get_section(chain)
        fn = self.etl.configdict.get(section, 'file_path')
        with open(fn, 'r') as f:
            contents = f.read()

        self.etl.run()
        
        self.assertTrue(mock_tx_execute.called)
        self.assertEqual(1, mock_tx_execute.call_count)
        args, kwargs = mock_tx_execute.call_args
        self.assertEqual(contents, args[1])
开发者ID:geopython,项目名称:stetl,代码行数:16,代码来源:test_postgres_db_output.py

示例4: test_execute

# 需要导入模块: from tests.stetl_test_case import StetlTestCase [as 别名]
# 或者: from tests.stetl_test_case.StetlTestCase import get_section [as 别名]
    def test_execute(self, mock_after_chain_invoke):
        chain = StetlTestCase.get_chain(self.etl)
        chain.run()

        # ZIP file contains two GML files, both should be extracted; count is 3 because of final
        # call, so the ZipFileExtractor can indicate that no more files can be found.
        self.assertTrue(mock_after_chain_invoke.called)
        self.assertEqual(3, mock_after_chain_invoke.call_count)

        # Check if temp file exists
        section = StetlTestCase.get_section(chain, 1)
        file_path = self.etl.configdict.get(section, 'file_path')
        self.assertTrue(os.path.exists(file_path))
        os.remove(file_path)
开发者ID:geopython,项目名称:stetl,代码行数:16,代码来源:test_zip_file_extractor.py

示例5: test_execute

# 需要导入模块: from tests.stetl_test_case import StetlTestCase [as 别名]
# 或者: from tests.stetl_test_case.StetlTestCase import get_section [as 别名]
 def test_execute(self):
     # Read content of input file
     chain = StetlTestCase.get_chain(self.etl)
     section = StetlTestCase.get_section(chain)
     fn = self.etl.configdict.get(section, 'file_path')
     with open(fn, 'r') as f:
         contents = f.read()
 
     # Invoke first component of chain
     chain.first_comp.do_init()
     packet = Packet()
     packet.init()
     packet.component = chain.first_comp
     chain.first_comp.before_invoke(packet)
     packet = chain.first_comp.invoke(packet)
     
     self.assertEqual(packet.data, contents)
开发者ID:fsteggink,项目名称:stetl,代码行数:19,代码来源:test_string_file_input.py

示例6: test_class

# 需要导入模块: from tests.stetl_test_case import StetlTestCase [as 别名]
# 或者: from tests.stetl_test_case.StetlTestCase import get_section [as 别名]
 def test_class(self):
     chain = StetlTestCase.get_chain(self.etl)
     section = StetlTestCase.get_section(chain, 1)
     class_name = self.etl.configdict.get(section, 'class')
     
     self.assertEqual('filters.xmlassembler.XmlAssembler', class_name)
开发者ID:fsteggink,项目名称:stetl,代码行数:8,代码来源:test_xml_assembler.py

示例7: test_class

# 需要导入模块: from tests.stetl_test_case import StetlTestCase [as 别名]
# 或者: from tests.stetl_test_case.StetlTestCase import get_section [as 别名]
 def test_class(self):
     chain = StetlTestCase.get_chain(self.etl)
     section = StetlTestCase.get_section(chain, -1)
     class_name = self.etl.configdict.get(section, 'class')
     
     self.assertEqual('outputs.dboutput.PostgresDbOutput', class_name)
开发者ID:fsteggink,项目名称:stetl,代码行数:8,代码来源:test_postgres_db_output.py

示例8: test_class

# 需要导入模块: from tests.stetl_test_case import StetlTestCase [as 别名]
# 或者: from tests.stetl_test_case.StetlTestCase import get_section [as 别名]
 def test_class(self):
     chain = StetlTestCase.get_chain(self.etl)
     section = StetlTestCase.get_section(chain)
     class_name = self.etl.configdict.get(section, 'class')
     
     self.assertEqual('inputs.fileinput.LineStreamerFileInput', class_name)
开发者ID:fsteggink,项目名称:stetl,代码行数:8,代码来源:test_line_streamer_file_input.py

示例9: check_execution_result

# 需要导入模块: from tests.stetl_test_case import StetlTestCase [as 别名]
# 或者: from tests.stetl_test_case.StetlTestCase import get_section [as 别名]
 def check_execution_result(self, chain, result, with_namespace):        
     section = StetlTestCase.get_section(chain, 1)
     element_tags = self.etl.configdict.get(section, 'element_tags')
     pattern = "<Element %s%s " % ('{[^}]+}' if with_namespace else '', element_tags)
     for elem in result:
         self.assertIsNotNone(re.match(pattern, elem))
开发者ID:fsteggink,项目名称:stetl,代码行数:8,代码来源:test_xml_element_reader.py


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