Skip to main content

pymocko

This is to generate mock data

Installation:

python -m pip install pymocko

Development Eviroment:

git clone https://github.com/datnguye/pymocko.git
cd pymocko/pymocko

python -m venv env
.\env\Scripts\activate
OR source env/bin/activate (linux)

python -m pip install -r requirements.txt

Run test cases:

cd ..
python run.py

Version used

Python 3.7.5

USAGE

Mokcing by json model:

print("Mock model")
print(model.mock(schema_json={"id":"num", "name":"word", "qty":"num", "unit_price":"price", "created_at":"date", "updated_at":"date"}, count=5))
print(model.mock(schema_json={"id":"num", "user_name":"word", "name":"word", "dob":"date", "phone_no":"char", "email":"word", "gender":"word", "ip_address":"char"}, count=5))
print(model.mock(schema_json={"id":"num", "name":"word", "qty": { "stocked": "num", "online": "num" }, "price":[ { "unit_price":"price", "effective_date": "date"} ], "created_at":"date", "updated_at":"date"}, count=3))
print(model.mock(schema_json={"id":"num", "name":"word", "tags": ["word"], "reference_names": [ "word" ], "qty": { "stocked": "num", "online": "num" }, "price":[ { "unit_price":"price", "effective_date": "date"} ], "created_at":"date", "updated_at":"date"}, count=3))

Randomize number:

from pymocko import num
print(num.mock())
print(num.mock(f=1, t=10))
print(num.mock(f=1, t=1000, neg=True))

Randomize price:

from pymocko import price
print(price.mock())
print(price.mock(f=1000, t=10000))
print(price.mock(f=0, t=2500, decimal=0))
print(price.mock(f=0, t=2500, decimal=4))
print(price.mock(f=0, t=2500, neg=True))

Randomize date:

from pymocko import date
print(date.mock())
print(date.mock(f=datetime.datetime(2020,6,1)))

Randomize character:

from pymocko import char
print(char.mock())
print(char.mock(no_of_char=20,number_inc=True))
print(char.mock(no_of_char=30,number_inc=True,special_inc=True))

Randomize word/sentence:

from pymocko import word
print(word.mock()) 
print(word.mock(no_of_word=20))
print(word.mock(no_of_word=10, upper_first=True))
print(word.mock_phone())
print(word.mock_phone(prefix="+84"))
print(word.mock_email())
print(word.mock_email(domain="data.com"))
print(word.mock_gender())

Metadata

Release files for pymocko 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymocko 0.1.4
File Size Uploaded Provenance
pymocko-0.1.4.tar.gz 11.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pymocko 0.1.4
File Interpreter ABI Platform
pymocko-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 23.2 kB

Release files / pymocko-0.1.4.tar.gz

Download URL pymocko-0.1.4.tar.gz
Size 11.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bcc2385320b908d46e979ef33175112c92b8fb3bce321bbc7c3da812cf6aebd9
BLAKE2b-256 checksum
How to use checksums
af325596337dc59856653a1bb105d64a07c9392f49475a90b0adcd2f94e6e678
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.5

Release files / pymocko-0.1.4-py3-none-any.whl

Download URL pymocko-0.1.4-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b226806279441a0877ba6e48e4298cb3d88de7db7a676ef5b828f08e86bd11b9
BLAKE2b-256 checksum
How to use checksums
65c457466e4185e69275f97f78d7bda38e60310f3448e260e5f8cfe6b89b0e9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.5

Security for pymocko 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page