Skip to content

Commit

Permalink
Updated christmas tree
Browse files Browse the repository at this point in the history
  • Loading branch information
zhendrikse committed Oct 17, 2024
1 parent 10e58bc commit 41f3f11
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 77 deletions.
51 changes: 2 additions & 49 deletions kata-solutions/christmas-tree/christmas-tree-python/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ authors = ["Zeger Hendrikse <zegerh@yahoo.co.uk>"]

[tool.poetry.dependencies]
python = ">=3.10.0,<=3.13"
mamba = "^0.11.2"
expects = "^0.9.0"
pytest-watch = "^4.2.0"
coverage = "^7.6.3"
pyhamcrest = "^2.1.0"
pytest = "^8.3.3"

[tool.poetry.dev-dependencies]

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PYTHONPATH=src poetry run mamba --format=documentation test/tree_spec.py --enable-coverage && poetry run coverage html
poetry run pytest
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PYTHONPATH=src poetry run ptw --runner="poetry run mamba --format=documentation --enable-coverage test/tree_spec.py"
poetry run ptw

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import pytest
from hamcrest import *

def christmas_tree(height):
if height == 1:
return ["*",
"|"]
elif height == 2:
return [" *",
"***",
" |"]
elif height ==3:
return [" *",
" ***",
"*****",
" |"]
return ["|"]

class TestChristmasTree:

def test_a_new_ChristmasTree_0(self):
assert_that(christmas_tree(0),
equal_to(["|"]))

def test_a_new_ChristmasTree_1(self):
assert_that(christmas_tree(1),
equal_to(["*",
"|"]))

def test_a_new_ChristmasTree_2(self):
assert_that(christmas_tree(2),
equal_to([" *",
"***",
" |"]))

def test_a_new_ChristmasTree_3(self):
assert_that(christmas_tree(3),
equal_to([" *",
" ***",
"*****",
" |"]))

0 comments on commit 41f3f11

Please sign in to comment.