Exemplo n.º 1
0
 def python_len_test(self):
     file_contents = xpm.get_file_contents('test_files/single_line.py')
     assert xpm.python_len(file_contents) == 22
     file_contents = xpm.get_file_contents('test_files/multi_line.py')
     assert xpm.python_len(file_contents) == 43
     file_contents = xpm.get_file_contents('test_files/mixed_line.py')
     assert xpm.python_len(file_contents) == 76
Exemplo n.º 2
0
 def get_file_contents_test(self):
     with open('expected/get_file_contents_single_line.txt') as file:
         expected = file.read()
         output = str(xpm.get_file_contents('test_files/single_line.py'))
         assert expected == output, "single_line test failed."
     with open('expected/get_file_contents_multi_line.txt') as file:
         expected = file.read()
         output = str(xpm.get_file_contents('test_files/multi_line.py'))
         assert expected == output, "multi_line test failed."
     with open('expected/get_file_contents_mixed_line.txt') as file:
         expected = file.read()
         output = str(xpm.get_file_contents('test_files/mixed_line.py'))
         assert expected == output, "mixed_line test failed."
Exemplo n.º 3
0
 def extract_python_test(self):
     with open('expected/extract_python_single_line.txt') as file:
         expected = file.read()
         file_contents = xpm.get_file_contents('test_files/single_line.py')
         output = str(xpm.extract_python(file_contents))
         assert expected == output
     with open('expected/extract_python_multi_line.txt') as file:
         expected = file.read()
         file_contents = xpm.get_file_contents('test_files/multi_line.py')
         output = str(xpm.extract_python(file_contents))
         assert expected == output
     with open('expected/extract_python_mixed_line.txt') as file:
         expected = file.read()
         file_contents = xpm.get_file_contents('test_files/mixed_line.py')
         output = str(xpm.extract_python(file_contents))
         assert expected == output
Exemplo n.º 4
0
 def num_calls_open_test(self):
     file_contents = xpm.get_file_contents('test_files/num_calls_open_test1.py')
     assert xpm.num_calls_open(file_contents) == 13