示例#1
0
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']])
示例#2
0
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']])
示例#3
0
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()
示例#4
0
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()
示例#5
0
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'])
示例#6
0
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'])
示例#7
0
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)
示例#8
0
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)
示例#9
0
def test_parser_and_long_args():
    parser_cleanup()
    assert_equal(cliparser.parse(['stack.stk', '--display', '--random']),
                 [['stack.stk'], ['--display', '--random']])
示例#10
0
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']])
示例#11
0
def test_parser_with_valid_file():
    parser_cleanup()
    create_test_files()
    assert_equal(cliparser.parse(['stack.stk', '-d', '-r']),
                 [['stack.stk'], ['-d', '-r']])
示例#12
0
def test_parser_with_single_type_arg():
    parser_cleanup()
    assert_equal(cliparser.parse(['--list']), [[], ['--list']])
示例#13
0
def test_parser_and_long_args():
	parser_cleanup()
	assert_equal(cliparser.parse(['stack.stk', '--display', '--random']),[['stack.stk'],['--display','--random']])
示例#14
0
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']])
示例#15
0
def test_parser_with_valid_file():
	parser_cleanup()
	create_test_files()
	assert_equal(cliparser.parse(['stack.stk', '-d', '-r']), [['stack.stk'],['-d', '-r']])
示例#16
0
def test_parser_with_single_type_arg():
	parser_cleanup()
	assert_equal(cliparser.parse(['--list']), [[],['--list']])