Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 029d0b7

Browse files
author
Lorena Mesa
committedJul 17, 2024·
Add empty init files for Python modules
1 parent 0254d88 commit 029d0b7

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed
 

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Users often work collaboratively in digital environments where a profile picture
2121
3. Identicon's should use accessible colors as specified by [W3](https://www.w3.org/WAI/WCAG21/Techniques/general/G207)
2222

2323
## TODO:
24-
- [ ] Finish script to implement identicon
25-
- [ ] Implement core logic to generate a Python PIL or Tinkr image
24+
- [ ] Finish script to implement identicon with multiple colors
25+
- [X] Implement core logic to generate a Python PIL or Tinkr image
2626
- [ ] Write baseline tests
2727
- [ ] Add CI/CD with GitHub actions to run tests

‎__init__.py

Whitespace-only changes.

‎main.py

-5
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,3 @@ def len_gt_zero(input_str: str):
124124

125125
identicon = Identicon(input_str=args.string)
126126
identicon.draw_image(filename=args.output)
127-
128-
# hash_str =convert_string_to_sha_hash("931D387731bBbC988B31220")
129-
# hash_str = convert_string_to_sha_hash("me@lorenamesa.com")
130-
# grid = build_grid(hash_str)
131-
# draw_image(grid, hash_str)

‎requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ruffruff check --fix
1+
ruff

‎test/__init__.py

Whitespace-only changes.

‎test/sample_cases_test.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
#!/usr/bin/env python3
22

33
from pathlib import Path
4+
from PIL import Image
45
import subprocess
56
import unittest
67

8+
from main import Identicon
9+
710
__author__ = "Lorena Mesa"
811
__email__ = "me@lorenamesa.com"
912

1013
PROJECT_ROOT = Path(__file__).parent.parent.absolute()
1114

1215

13-
class TestHappyPath(unittest.TestCase):
14-
def test_fails_to_create_identicon_with_input_text_missing(self):
16+
class TestUI(unittest.TestCase):
17+
def test_ui_fails_to_create_identicon_with_input_text_missing(self):
1518
with self.assertRaises(subprocess.CalledProcessError) as context:
16-
subprocess.check_output(f'python3 {PROJECT_ROOT}/main.py', shell=True, stderr=subprocess.STDOUT).strip()
19+
subprocess.check_output(f"python3 {PROJECT_ROOT}/main.py", shell=True, stderr=subprocess.STDOUT).strip()
1720
self.assertIn(context.exception.message, "main.py: error: the following arguments are required: -s/--string")
18-
19-
def test_creates_identicon_when_input_text_provided(self):
20-
pass
2121

2222

23+
class TestHappyPath(unittest.TestCase):
24+
def test_successfully_creates_identicon(self):
25+
identicon = Identicon("931D387731bBbC988B31220")
26+
identicon.draw_image(filename="output")
27+
image = Image.open(f"{PROJECT_ROOT}/output.png", mode="r")
28+
self.assertIsInstance(image, Image, "Image created is not of type PIL.Image")
29+
2330
# hash_str =convert_string_to_sha_hash("931D387731bBbC988B31220")
2431
# hash_str = convert_string_to_sha_hash("me@lorenamesa.com")
2532
# grid = build_grid(hash_str)

0 commit comments

Comments
 (0)
Please sign in to comment.