Пример #1
0
 def test_invalid_command(self):
     working_dir = pathlib.Path().absolute()
     test_file = os.path.join(working_dir, "invalid.txt")
     temp_stdout = StringIO()
     with contextlib.redirect_stdout(temp_stdout):
         main([test_file])
     output = temp_stdout.getvalue().splitlines()
     self.assertEqual(output[0], "Invalid Command INVALID")
Пример #2
0
 def test_correct_calls(self, load, exchange):
     working_dir = pathlib.Path().absolute()
     test_file = os.path.join(working_dir, "input.txt")
     main([test_file])
     self.assertTrue(exchange.called)
     self.assertEqual(4, exchange.call_count)
     self.assertTrue(load.called)
     self.assertEqual(2, load.call_count)
Пример #3
0
 def test_correct_output(self):
     working_dir = pathlib.Path().absolute()
     test_file = os.path.join(working_dir, "input.txt")
     temp_stdout = StringIO()
     with contextlib.redirect_stdout(temp_stdout):
         main([test_file])
     output = temp_stdout.getvalue().splitlines()
     self.assertEqual(output[0], "1 3 N")
     self.assertEqual(output[1], "5 1 E")
Пример #4
0
    def test_incorrect_path(self):
        with self.assertRaises(SystemExit):
            working_dir = pathlib.Path().absolute()
            test_file = os.path.join(working_dir, "fake_gfg.txt")

            temp_stdout = StringIO()
            with contextlib.redirect_stdout(temp_stdout):
                main([test_file])
            output = temp_stdout.getvalue().splitlines()
            self.assertEqual(
                output[0], "The path specified does not exist or "
                "is not a file")
Пример #5
0
__remake__ = 'Ashen'
__url__ = 'imashen.cn'

import pygame as pg
from source.main import main

if __name__ == '__main__':
    main()
    pg.quit()
Пример #6
0
#! /usr/bin/env python

import sys
from os.path import join
sys.path.append(join('source', 'lib'))

from source.main import main
main()

Пример #7
0
def test_bad_date():
    with pytest.raises(ValueError):
        main('tests/test_files/bad_date.csv')
Пример #8
0
def test_bad_columns():
    with pytest.raises(ValueError) as ve:
        main('tests/test_files/bad_columns.csv')
Пример #9
0
def test_bad_event():
    with pytest.raises(ValueError):
        main('tests/test_files/bad_event.csv')
Пример #10
0
def run(event, context):
    main()
Пример #11
0
#!/usr/bin/env python3

import sys
import pygame
from source import main

if __name__ == '__main__':
    main.main()
    pygame.quit()
    sys.exit()
Пример #12
0
from source.main import main

if __name__ == '__main__':
    main('input.csv')