コード例 #1
0
 def test_shared_mode(self):
     element = CsvDataSetConfig(file_path=exist_file,
                                variable_names=['var1', 'var2'],
                                share_mode=ShareMode.GROUP)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['CSVDataSet']['stringProp'][4]['#text'] == 'shareMode.group'
コード例 #2
0
 def test_file_encoding(self):
     element = CsvDataSetConfig(file_path=exist_file,
                                variable_names=['var1', 'var2'],
                                file_encoding=FileEncoding.UTF16)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['CSVDataSet']['stringProp'][2]['#text'] == 'UTF-16'
コード例 #3
0
 def test_stop_thread(self):
     element = CsvDataSetConfig(file_path=exist_file,
                                variable_names=['var1', 'var2'],
                                stop_thread=True)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['CSVDataSet']['boolProp'][3]['#text'] == 'true'
コード例 #4
0
 def test_delimiter(self):
     element = CsvDataSetConfig(file_path=exist_file,
                                variable_names=['var1', 'var2'],
                                delimiter='|')
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['CSVDataSet']['stringProp'][1]['#text'] == '|'
コード例 #5
0
 def test_hashtree_contain(self):
     element = CsvDataSetConfig(
         file_path='main.py',
         variable_names=['var1', 'var2'],
     )
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     assert '<hashTree />' in rendered_doc
コード例 #6
0
 def test_recycle(self):
     element = CsvDataSetConfig(file_path='main.py',
                                variable_names=['var1', 'var2'],
                                recycle=True)
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['CSVDataSet']['boolProp'][2][
         '#text'] == 'true'
コード例 #7
0
 def test_header_contain(self):
     element = CsvDataSetConfig(
         file_path='main.py',
         variable_names=['var1', 'var2'],
     )
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     is_contain = 'xml version' in rendered_doc
     assert is_contain is False
コード例 #8
0
 def test_variable_names(self):
     element = CsvDataSetConfig(
         file_path='main.py',
         variable_names=['var1', 'var2', 'var3', 'var4'],
     )
     rendered_doc = tag_wrapper(element.to_xml(), 'result')
     parsed_doc = xmltodict.parse(rendered_doc)
     assert parsed_doc['result']['CSVDataSet']['stringProp'][5][
         '#text'] == 'var1,var2,var3,var4'
コード例 #9
0
 def test_type_check(self):
     with pytest.raises(TypeError, match=r".*must be bool.*"):
         CsvDataSetConfig(file_path='main.py',
                          variable_names=['var1', 'var2'],
                          stop_thread='True')
コード例 #10
0
 def test_positive2(self):
     file_path = './main.py'
     csvdata = CsvDataSetConfig(file_path=file_path,
                                variable_names=['var1', 'var2'])
     assert csvdata.file_path == file_path
コード例 #11
0
 def test_type_check(self):
     with pytest.raises(TypeError, match=r".*must be ShareMode*"):
         CsvDataSetConfig(file_path=exist_file,
                          variable_names=['var1', 'var2'],
                          share_mode='True')
コード例 #12
0
 def test_positive(self):
     csvdata = CsvDataSetConfig(file_path='main.py',
                                variable_names=['var1', 'var2'],
                                file_encoding=FileEncoding.ISO8859)
     assert csvdata.file_encoding == FileEncoding.ISO8859
コード例 #13
0
 def test_type_check(self):
     with pytest.raises(FileNotFoundError, match=r".*is not file*"):
         CsvDataSetConfig(file_path='ErrorPath',
                          variable_names=['var1', 'var2'])
コード例 #14
0
 def test_content_type_check2(self):
     with pytest.raises(TypeError, match=r".*must contain chars*"):
         CsvDataSetConfig(file_path='main.py',
                          variable_names=['asdfg', '123', 'qwerty'])
コード例 #15
0
 def test_positive(self):
     csvdata = CsvDataSetConfig(
         file_path='main.py',
         variable_names=['asdfg', 'vbn', 'qwerty'],
         delimiter='|')
     assert csvdata.variable_names == 'asdfg|vbn|qwerty'
コード例 #16
0
 def test_type_check(self):
     with pytest.raises(TypeError,
                        match=r".*variable_names must be List[str]*"):
         CsvDataSetConfig(file_path='main.py',
                          variable_names={'randkey': 'randvalue'})
コード例 #17
0
 def test_positive(self):
     csvdata = CsvDataSetConfig(file_path='main.py',
                                variable_names=['var1', 'var2'],
                                recycle=True)
     assert csvdata.recycle == True
コード例 #18
0
 def test_type_check(self):
     with pytest.raises(TypeError, match=r".*must be bool.*"):
         CsvDataSetConfig(file_path=exist_file,
                          variable_names=['var1', 'var2'],
                          recycle='True')
コード例 #19
0
 def test_type_check(self):
     with pytest.raises(TypeError, match=r".*must be FileEncoding*"):
         CsvDataSetConfig(file_path=exist_file,
                          variable_names=['var1', 'var2'],
                          file_encoding='UTF-8')
コード例 #20
0
 def test_positive2(self):
     csvdata = CsvDataSetConfig(
         file_path=exist_file, variable_names=['var1', 'var2'])
     assert csvdata.file_path == exist_file
コード例 #21
0
 def test_content_type_check(self):
     with pytest.raises(TypeError,
                        match=r".*All elements must be str*"):
         CsvDataSetConfig(file_path='main.py',
                          variable_names=['asdfg', 123, 'qwerty'])
コード例 #22
0
 def test_positive(self):
     csvdata = CsvDataSetConfig(file_path='main.py',
                                variable_names=['var1', 'var2'],
                                stop_thread=True)
     assert csvdata.stop_thread == True
コード例 #23
0
 def test_positive(self):
     csvdata = CsvDataSetConfig(
         file_path='main.py', variable_names=['asdfg', 'vbn', 'qwerty'])
     assert csvdata.variable_names == 'asdfg,vbn,qwerty'
コード例 #24
0
 def test_type_check2(self):
     with pytest.raises(TypeError, match=r".*must be ShareMode*"):
         CsvDataSetConfig(file_path='main.py',
                          variable_names=['var1', 'var2'],
                          share_mode=123456)
コード例 #25
0
 def test_type_check2(self):
     with pytest.raises(TypeError, match=r".*must be FileEncoding*"):
         CsvDataSetConfig(file_path='main.py',
                          variable_names=['var1', 'var2'],
                          file_encoding=100)
コード例 #26
0
 def test_positive(self):
     csvdata = CsvDataSetConfig(file_path='main.py',
                                variable_names=['var1', 'var2'],
                                share_mode=ShareMode.ALL)
     assert csvdata.share_mode == ShareMode.ALL
コード例 #27
0
 def test_type_check2(self):
     with pytest.raises(TypeError, match=r".*must be bool.*"):
         CsvDataSetConfig(file_path='main.py',
                          variable_names=['var1', 'var2'],
                          ignore_first_line=123456)
コード例 #28
0
 def test_positive(self):
     csvdata = CsvDataSetConfig(file_path='main.py',
                                variable_names=['var1', 'var2'])
     assert csvdata.file_path == 'main.py'
コード例 #29
0
 def test_positive(self):
     csvdata = CsvDataSetConfig(file_path='main.py',
                                variable_names=['var1', 'var2'],
                                ignore_first_line=True)
     assert csvdata.ignore_first_line == True
コード例 #30
0
 def test_type_check2(self):
     with pytest.raises(TypeError, match=r".*must be bool.*"):
         CsvDataSetConfig(file_path=exist_file,
                          variable_names=['var1', 'var2'],
                          stop_thread=123456)