• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

joke2k / faker / 3095 / 5
96%
master: 96%

Build:
DEFAULT BRANCH: master
Ran 08 Oct 2020 02:53PM UTC
Files 453
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

08 Oct 2020 02:43PM UTC coverage: 98.661% (-0.02%) from 98.68%
TOXENV=py36

push

travis-ci

web-flow
Add unique values support

* 🦄 Add unique values support to Faker

Adds support to Faker for guaranteed unique values.

A new `.unique` property has been added to the Proxy class, which
returns an instance of a `UniqueProxy`. Any attributes looked up on the
unique proxy goes to the common proxy. If the attribute is a function,
then it's wrapped with a wrapper that only allows unique values.

Obviously, it's not always possible to get a unique value, especially
with a small set of values. If the wrapper can't find a unique value
after a certain number of attempts (currently pegged at an arbitrary
1000), it throws a UniquenessSanityException.

Each "remembered" set of values is tied to the name of the function, and
the arguments passed to it, so, for example, different `.random_int()`
calls with different arguments will not share a "bucket".

Since it uses a set internally for remembering previous values, and a
dictionary for determining what bucket to use, it can't be used with any
arguments or return values that are unhashable.

* 🐑 Fix flake8 linting

Trim some unused imports, add some set literals, add some line breaks.
Makes changes as required to pass flake8

* ⚠️ Changed exception name; fallback behaviour

- The exception that the unique wrapper throws after too many iterations
  is now called `UniquenessException`, and also includes an error
  message explaining how many iterations were attempted.

- Accessing a non-callable through the `.unique` attribute now throws a
  TypeError.

* 📦 Fix accidental unpacking of arguments in key

The key for looking up previously generated values of a specific
invocation of a function accidentally unpacked the arguments of `args`,
making key a variable length tuple.

This commit fixes that mistake, so the keys are now consistently
3-tuples.

* 📄 Add documentation for .unique attribute

First pass at documentation for the .unique attribute.

* 📄 Tweak documentati... (continued)

7071 of 7167 relevant lines covered (98.66%)

0.99 hits per line

Source Files on job 3095.5 (TOXENV=py36)
  • Tree
  • List 0
  • Changed 5
  • Source Changed 3
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 2929
  • Travis Job 3095.5
  • f94161b9 on github
  • Prev Job for TOXENV=py36 on master (#3092.5)
  • Next Job for TOXENV=py36 on master (#3097.5)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc