Giter Club home page Giter Club logo

data-factory's Introduction

https://travis-ci.org/italomaia/data-factory.svg?branch=master https://coveralls.io/repos/italomaia/data-factory/badge.png

Data Factory

Data factory is a simple data generator easily coupled with your web project. It's main use is to generate data for your orm during tests.

Random

All data generated with data-factory is pseudo-random. That means a factory method does not always return the same value, but it always return the same "kind of value" you expect. This is very important because this way your tests became fuzzy.

If you have a field in your model that can receive a integer of any kind and you always give it the same number for testing purpose, your field will ONLY be tested for that particular number.

If you test your model field with data from a range of numbers (like the field domain), like [1,2,3,4,5] even if only one of these numbers is randomly picked each time, your field test is safe for the whole range of numbers (theoretically). That's fuzzy testing!

What Data Factory is NOT!

DataFactory is not a object factory for ORM's, like ModelMommy or DynamicFixture. It only creates the right raw fuzzy data that you expect. However, DataFactory could be easily used to power up a object factory as it tries to give you just the right range for the most common types.

Supported data

  • None (with or_null)
  • Boolean
  • Choices (pick from list)
  • DateTime
  • Tiny integer (and positive tiny integer)
  • Small integer (and positive small integer)
  • Integer (and positive integer)
  • Big integer (and positive big integer)
  • Decimal (and positive decimal)
  • Real
  • Double
  • Binary
  • String
  • ASCII String
  • Unicode String
  • Slug

Usage

>>> from data_factory import make_integer, make_small_integer
>>> random_integer = make_integer()  # gets you a 32bits random integer
>>> random_small_integer = make_small_integer()  # gets you a 16bits random integer

About some fields

This section cover some useful information about generated data.

  • Positive integer methods were made, mostly, to generate proper values for database unsigned types.
  • Positive decimal data is mostly used for monetary values which, usually, can not be negative.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.