def test_parser_with_edit_arg(): parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', '-d', '--edit']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', '-d', '-r', '-e']) parser_cleanup() assert_equal(cliparser.parse(['stack.stk','-e']),[['stack.stk'],['-e']]) parser_cleanup() assert_equal(cliparser.parse(['stack.stk','--edit']),[['stack.stk'],['--edit']])
def test_parser_with_edit_arg(): parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', '-d', '--edit']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', '-d', '-r', '-e']) parser_cleanup() assert_equal(cliparser.parse(['stack.stk', '-e']), [['stack.stk'], ['-e']]) parser_cleanup() assert_equal(cliparser.parse(['stack.stk', '--edit']), [['stack.stk'], ['--edit']])
def test_parser_with_all_arg(): parser_cleanup() assert_equal(cliparser.parse(['--all']),[[],['--all']]) parser_cleanup() assert_equal(cliparser.parse(['-a', '-r', '-s', '-v']), [[], ['-a', '-r', '-s', '-v']]) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['-a', '-e']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', 'fail.stk', '-a']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['fail.stk', '--all']) delete_files()
def test_parser_with_all_arg(): parser_cleanup() assert_equal(cliparser.parse(['--all']), [[], ['--all']]) parser_cleanup() assert_equal(cliparser.parse(['-a', '-r', '-s', '-v']), [[], ['-a', '-r', '-s', '-v']]) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['-a', '-e']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', 'fail.stk', '-a']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['fail.stk', '--all']) delete_files()
def test_parser_with_wildcard(): parser_cleanup() assert_equal(cliparser.parse(['stack.stk','-d','-w']),[['stack.stk'],['-d','-w']]) parser_cleanup() assert_equal(cliparser.parse(['-a','-w']),[[],['-a','-w']]) parser_cleanup() assert_equal(cliparser.parse(['stack.stk', 'example.stk', '--display', '--wildcard']),[['stack.stk', 'example.stk'],['--display', '--wildcard']]) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', '-d', '-r', '-w']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', 'example.stk', '-d', '-r', '-s', '-w']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['-a','-s', '-w'])
def test_parser_with_wildcard(): parser_cleanup() assert_equal(cliparser.parse(['stack.stk', '-d', '-w']), [['stack.stk'], ['-d', '-w']]) parser_cleanup() assert_equal(cliparser.parse(['-a', '-w']), [[], ['-a', '-w']]) parser_cleanup() assert_equal( cliparser.parse( ['stack.stk', 'example.stk', '--display', '--wildcard']), [['stack.stk', 'example.stk'], ['--display', '--wildcard']]) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', '-d', '-r', '-w']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['stack.stk', 'example.stk', '-d', '-r', '-s', '-w']) parser_cleanup() assert_raises(SystemExit, cliparser.parse, ['-a', '-s', '-w'])
def flashcard(): if len(sys.argv) == 1: errors.id(0) elif len(sys.argv) == 2 and sys.argv[1] == '-h' or sys.argv[1] == '--help': gethelp() elif len(sys.argv) == 2 and sys.argv[1] == '--gui': flashCardStudyGUI() elif len(sys.argv) >= 1: arguments = parse(sys.argv[1:]) processor(arguments)
def test_parser_and_long_args(): parser_cleanup() assert_equal(cliparser.parse(['stack.stk', '--display', '--random']), [['stack.stk'], ['--display', '--random']])
def test_parser_with_valid_file_and_args(): parser_cleanup() assert_equal(cliparser.parse(['stack.stk', '-d', '-r', '-s', '-v']), [['stack.stk'], ['-d', '-r', '-s', '-v']])
def test_parser_with_valid_file(): parser_cleanup() create_test_files() assert_equal(cliparser.parse(['stack.stk', '-d', '-r']), [['stack.stk'], ['-d', '-r']])
def test_parser_with_single_type_arg(): parser_cleanup() assert_equal(cliparser.parse(['--list']), [[], ['--list']])
def test_parser_and_long_args(): parser_cleanup() assert_equal(cliparser.parse(['stack.stk', '--display', '--random']),[['stack.stk'],['--display','--random']])
def test_parser_with_valid_file_and_args(): parser_cleanup() assert_equal(cliparser.parse(['stack.stk', '-d', '-r', '-s', '-v']),[['stack.stk'],['-d', '-r', '-s', '-v']])
def test_parser_with_valid_file(): parser_cleanup() create_test_files() assert_equal(cliparser.parse(['stack.stk', '-d', '-r']), [['stack.stk'],['-d', '-r']])
def test_parser_with_single_type_arg(): parser_cleanup() assert_equal(cliparser.parse(['--list']), [[],['--list']])