On Mon, Oct 17, 2016 at 7:37 PM, Wes Turner <wes.turner@gmail.com> wrote:
> There is a new K–12 Computer Science Framework:
> [...]
>
> - Additionally,
> I can't help but wonder whether it makes sense it start with TDD
> (Test-Driven Development) first when teaching Python (and STEM, and CS, in
> general).
Hello World with TDD (and links to {Wikipedia, DBPedia} concept URIs):
https://westurner.org/2016/10/17/teaching-test-driven-development-first.html
import unittest
class TestHelloWorld(unittest.Testcase):
def setUp(self):
# print("setUp")
self.data = {'name': 'TestName'}
def test_hello_world(self, data=None):
if data is None:
data = self.data
name = data['name']
expected_output = "Hello, {}!".format(name)
output = hello_world(name)
assert expected_output == output
self.assertEqual(ouput, expected_output)
# def tearDown(self):
# print("tearDown")
# print(json.dumps(self.data, indent=2))