Skip to content

Commit c98c2f9

Browse files
committed
15-techno beat test and readme
1 parent f6b3f57 commit c98c2f9

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed

exercises/15-Techno_beat/app.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def lyrics_generator(numbers):
2+
zero = []
3+
for x in numbers:
4+
if x == 1:
5+
zero.append("Drop the base")
6+
elif x == 0:
7+
zero.append("boom")
8+
return zero
9+
10+
print(lyrics_generator([0,0,1,1,0,0,0]))
11+
print(lyrics_generator([0,0,1,1,1,0,0,0]))
12+
print(lyrics_generator([0,0,0]))
13+
print(lyrics_generator([1,0,1]))
14+
print(lyrics_generator([1,1,1]))

exercises/15-Techno_beat/test.py

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,39 @@
77
import app.py
88
import pytest
99

10-
@pytest.mark.it("")
11-
def test_():
12-
captured = buffer.getvalue()
13-
assert "\n" in captured
1410

15-
@pytest.mark.it("")
16-
def test_():
11+
12+
13+
@pytest.mark.it("Create a function lyrics_generator")
14+
def test_function():
1715
f = open(os.path.dirname(os.path.abspath(__file__)) +'/app.py')
1816
content = f.read()
19-
assert content.fint()
17+
assert content.fint("lyrics_generator")
2018

2119

22-
@pytest.mark.it("")
23-
def test_():
20+
@pytest.mark.it("Use for loop")
21+
def test_for():
2422
f = open(os.path.dirname(os.path.abspath(__file__)) +'/app.py')
2523
content = f.read()
26-
assert content.find()
24+
assert content.find("for")
25+
26+
@pytest.mark.it("Use conditionals if/elif/else")
27+
def test_conditinal():
28+
f = open(os.path.dirname(os.path.abspath(__file__)) +'/app.py')
29+
content = f.read()
30+
assert content.find("for")
31+
32+
@pytest.mark.it("Add the value to the new list")
33+
def test_append():
34+
f = open(os.path.dirname(os.path.abspath(__file__)) +'/app.py')
35+
content = f.read()
36+
assert content.find("append")
37+
38+
@pytest.mark.it("Print the strings like song")
39+
def test_output():
40+
captured = buffer.getvalue()
41+
assert "\n" in captured
42+
43+
44+
45+

0 commit comments

Comments
 (0)