本文整理汇总了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)
示例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')
示例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])
示例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)
示例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)
示例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)
示例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)
示例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)
示例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))