Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/coolname/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package:
name: coolname
version: 2.2.0
top-level:
- coolname

source:
sha256: 4d1563186cfaf71b394d5df4c744f8c41303b6846413645e31d31915cdeb13e8
url: https://files.pythonhosted.org/packages/1b/b1/5745d7523d8ce53b87779f46ef6cf5c5c342997939c2fe967e607b944e43/coolname-2.2.0-py2.py3-none-any.whl

about:
home: https://github.com/alexanderlukanin13/coolname
Comment thread
jolaf marked this conversation as resolved.
PyPI: https://pypi.org/project/coolname
license: BSD-2-Clause
50 changes: 50 additions & 0 deletions packages/coolname/test_coolname.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from pytest_pyodide import run_in_pyodide


@run_in_pyodide(packages=["coolname"])
def test_coolname(selenium):
from coolname import generate, generate_slug, get_combinations_count, RandomGenerator

words = generate()
assert list
assert isinstance(words, list)
assert all(isinstance(word, str) for word in words)
assert not any('-' in word for word in words)

name = generate_slug()
assert isinstance(name, str)
assert '-' in name
assert not name.startswith('-')
assert not name.endswith('-')

name = generate_slug(4)
assert isinstance(name, str)
assert '-' in name
assert not name.startswith('-')
assert not name.endswith('-')
assert len(name.split('-')) >= 4

n = get_combinations_count(4)
assert isinstance(n, int)
assert n > 10 ** 10

generator = RandomGenerator({
'all': {
'type': 'cartesian',
'lists': ['first_name', 'last_name']
},
'first_name': {
'type': 'words',
'words': ['james', 'john']
},
'last_name': {
'type': 'words',
'words': ['smith', 'brown']
}
})
name = generator.generate_slug()
assert isinstance(name, str)
assert '-' in name
assert not name.startswith('-')
assert not name.endswith('-')
assert len(name.split('-')) == 2