-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bdb07e7
commit dd8a766
Showing
6 changed files
with
70 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
**/__pycache__ | ||
|
||
.venv/ | ||
dist/ | ||
__pycache__ | ||
|
||
.mypy_cache | ||
.pytest_cache | ||
.venv | ||
.vscode | ||
.python-version | ||
|
||
dist | ||
|
||
poetry.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .colorhash import ColorHash | ||
from colorhash.colorhash import ColorHash | ||
|
||
__all__ = [ColorHash] | ||
__all__ = ["ColorHash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
[tool.poetry] | ||
name = "colorhash" | ||
version = "1.0.3" | ||
version = "1.0.4" | ||
description = "Generate color based on any object" | ||
authors = [ | ||
"dimostenis", | ||
"Felix Krull <[email protected]>" | ||
] | ||
license = "MIT" | ||
include = [ | ||
"README.md", | ||
] | ||
|
||
readme = "README.md" | ||
homepage = "https://github.com/dimostenis/color-hash-python" | ||
|
@@ -18,16 +21,22 @@ keywords = ["color", "hash"] | |
"Bug Tracker" = "https://github.com/dimostenis/color-hash-python/issues" | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.3" | ||
python = "^3.6" | ||
|
||
[tool.poetry.dev-dependencies] | ||
mypy = "^0.782" | ||
flake8 = "^3.8.3" | ||
black = "^20.8b1" | ||
pytest = "^6.2.5" | ||
|
||
[build-system] | ||
requires = ["poetry>=0.12"] | ||
build-backend = "poetry.masonry.api" | ||
[tool.isort] | ||
profile = "black" | ||
multi_line_output = 7 | ||
force_single_line = true | ||
|
||
[tool.black] | ||
line-length = 88 | ||
|
||
[build-system] | ||
requires = ["poetry>=0.12"] | ||
build-backend = "poetry.masonry.api" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from pytest import fixture | ||
|
||
from colorhash import ColorHash | ||
|
||
|
||
@fixture | ||
def objs(): | ||
return ( | ||
"foo", | ||
"bar", | ||
None, | ||
[0, 1], | ||
{1, 2}, | ||
{"a": 0}, | ||
ColorHash("w00t"), | ||
) | ||
|
||
|
||
def test_colorhash_returns_some_color(objs): | ||
|
||
for obj in objs: | ||
assert isinstance(ColorHash(obj).hex, str) | ||
|
||
|
||
def test_colorhash_is_deterministic(objs): | ||
|
||
for obj in objs: | ||
assert ColorHash(obj).hex == ColorHash(obj).hex |