Skip to content

Commit

Permalink
Merge branch 'main' of github.com:kantord/LibreLingo
Browse files Browse the repository at this point in the history
  • Loading branch information
kantord committed Jan 16, 2022
2 parents 8f03b37 + bb74688 commit 1e8a99e
Show file tree
Hide file tree
Showing 21 changed files with 623 additions and 436 deletions.
10 changes: 10 additions & 0 deletions apps/librelingo_fakes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,13 @@ fake_course = fakes.customize(fakes.course1, modules=[
])
```

<a name="librelingo_fakes.fakes.number"></a>
#### number

```python
number(max_value=10000)
```

Returns a 'random' non-negative integer.
It is NOT cryptographically-secure.

12 changes: 10 additions & 2 deletions apps/librelingo_fakes/librelingo_fakes/fakes.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,17 @@
)


def number(max_value=10000):
"""
Returns a 'random' non-negative integer.
It is NOT cryptographically-secure.
"""
return random.randint(0, max_value) # NOSONAR


def fake_value():
FakeValue = namedtuple("FakeValue", ["id"])
return FakeValue(random.randint(0, 10000))
return FakeValue(number())


def customize(fake, **kwargs):
Expand All @@ -279,4 +287,4 @@ def customize(fake, **kwargs):


def path():
return Path(f"./path{random.randint(0, 5000)}")
return Path(f"./path{number(max_value=5000)}")
Loading

1 comment on commit 1e8a99e

@vercel
Copy link

@vercel vercel bot commented on 1e8a99e Jan 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.