Skip to content

Commit

Permalink
Add empty init files for Python modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Lorena Mesa committed Jul 17, 2024
1 parent 0254d88 commit 029d0b7
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Users often work collaboratively in digital environments where a profile picture
3. Identicon's should use accessible colors as specified by [W3](https://www.w3.org/WAI/WCAG21/Techniques/general/G207)

## TODO:
- [ ] Finish script to implement identicon
- [ ] Implement core logic to generate a Python PIL or Tinkr image
- [ ] Finish script to implement identicon with multiple colors
- [X] Implement core logic to generate a Python PIL or Tinkr image
- [ ] Write baseline tests
- [ ] Add CI/CD with GitHub actions to run tests
Empty file added __init__.py
Empty file.
5 changes: 0 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,3 @@ def len_gt_zero(input_str: str):

identicon = Identicon(input_str=args.string)
identicon.draw_image(filename=args.output)

# hash_str =convert_string_to_sha_hash("931D387731bBbC988B31220")
# hash_str = convert_string_to_sha_hash("[email protected]")
# grid = build_grid(hash_str)
# draw_image(grid, hash_str)
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruffruff check --fix
ruff
Empty file added test/__init__.py
Empty file.
19 changes: 13 additions & 6 deletions test/sample_cases_test.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
#!/usr/bin/env python3

from pathlib import Path
from PIL import Image
import subprocess
import unittest

from main import Identicon

__author__ = "Lorena Mesa"
__email__ = "[email protected]"

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


class TestHappyPath(unittest.TestCase):
def test_fails_to_create_identicon_with_input_text_missing(self):
class TestUI(unittest.TestCase):
def test_ui_fails_to_create_identicon_with_input_text_missing(self):
with self.assertRaises(subprocess.CalledProcessError) as context:
subprocess.check_output(f'python3 {PROJECT_ROOT}/main.py', shell=True, stderr=subprocess.STDOUT).strip()
subprocess.check_output(f"python3 {PROJECT_ROOT}/main.py", shell=True, stderr=subprocess.STDOUT).strip()
self.assertIn(context.exception.message, "main.py: error: the following arguments are required: -s/--string")

def test_creates_identicon_when_input_text_provided(self):
pass


class TestHappyPath(unittest.TestCase):
def test_successfully_creates_identicon(self):
identicon = Identicon("931D387731bBbC988B31220")
identicon.draw_image(filename="output")
image = Image.open(f"{PROJECT_ROOT}/output.png", mode="r")
self.assertIsInstance(image, Image, "Image created is not of type PIL.Image")

# hash_str =convert_string_to_sha_hash("931D387731bBbC988B31220")
# hash_str = convert_string_to_sha_hash("[email protected]")
# grid = build_grid(hash_str)
Expand Down

0 comments on commit 029d0b7

Please sign in to comment.