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

joke2k / faker / 3095
96%

Build:
DEFAULT BRANCH: master
Ran 08 Oct 2020 02:47PM UTC
Jobs 9
Files 453
Run time 18min
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

pending completion
3095

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)

7067 of 7161 relevant lines covered (98.69%)

4.93 hits per line

Jobs
ID Job ID Ran Files Coverage
1 3095.1 (TOXENV=flake8) 08 Oct 2020 02:47PM UTC 0
0.0
Travis Job 3095.1
2 3095.2 (TOXENV=checkmanifest) 08 Oct 2020 02:49PM UTC 0
0.0
Travis Job 3095.2
3 3095.3 (TOXENV=isort) 08 Oct 2020 02:49PM UTC 0
0.0
Travis Job 3095.3
4 3095.4 (TOXENV=py35) 08 Oct 2020 02:53PM UTC 0
98.63
Travis Job 3095.4
5 3095.5 (TOXENV=py36) 08 Oct 2020 02:53PM UTC 0
98.66
Travis Job 3095.5
6 3095.6 (TOXENV=py37) 08 Oct 2020 02:53PM UTC 0
98.65
Travis Job 3095.6
7 3095.7 (TOXENV=py38) 08 Oct 2020 02:57PM UTC 0
98.68
Travis Job 3095.7
8 3095.8 (TOXENV=pypy3) 08 Oct 2020 03:03PM UTC 0
98.62
Travis Job 3095.8
9 3095.9 (TOXENV=32bit TEST_32BIT=1) 08 Oct 2020 03:00PM UTC 0
0.0
Travis Job 3095.9
Source Files on build 3095
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #3095
  • f94161b9 on github
  • Prev Build on master (#3092)
  • Next Build on master (#3097)
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