GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - tjkendev/python-testcase-generator: A testcase generator to generate a test case from Python expression

BranchesTags
Open more actions menu

Latest commit

 

History

41 Commits
41 Commits

Folders and files

NameName
Last commit message
Last commit date
python_testcase_generator
python_testcase_generator
 
 
test
test
 
 
.gitignore
.gitignore
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 
setup.py
setup.py
 
 

Repository files navigation

Python Test Case Generator

PyPI PyPI Travis

Python Test Case Generator that can generate a test case from Python expression.

This tool allows you to generate a test case by writing Python expressions directly.

Installation

$ pip install python-testcase-generator

Usage

By calling python-testcase-generator (or pytcgen) with no parameters, a test case is generated from stdin and output as stdout.

$ echo "[i**2 for i in range(9)]" | python-testcase-generator
0 1 4 9 16 25 36 49 64

To generate a test case from a file, you can specify input file path with -i parameter.
For example, to generate a test case from the file below:

$ cat test.txt
1 2 3 "a" ["b", "c"]
[1,2,3]*2 # comment
10*"a" 10**9+7

% # You can write expressions including space by using backquote (`).
% # It does not mean repr() in Python 2. (special specification in this tool)
`"b" * 15` `1 + 2 * 3`

% # You can use Python statement by beginning a line with percent sign (%).
% # Any character is not output in Python statement except print statement.
% x = [1, 2]; y = [9, 3, 4, "d"]
x[0] x y*2
{4, x[1], 6}

% # import and use library
% import random
% A=[random.randint(1, 10) for i in range(3)]
A

% # to_s function (builtin function in this tool)
% B=[[1,2,3],[4,5],[6,[7,8]]]
to_s(A, "\n")
to_s(B, ["\n","-"])

You can specify input file path as follows:

$ python-testcase-generator -i test.txt
1 2 3 a b c
1 2 3 1 2 3
aaaaaaaaaa 1000000007

bbbbbbbbbbbbbbb 7

1 1 2 9 3 4 d 9 3 4 d
2 4 6

7 5 1

7
5
1
1-2-3
4-5
6-7 8

Also, to write generated a test case to a file, specify output file path with -o parameter.

$ python-testcase-generator -i test.txt -o output.txt

About

A testcase generator to generate a test case from Python expression

Topics

pypipython

Resources

Readme
MIT license
Activity

Stars

10 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.