2015-04-25 19:32:04 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
import hello_world
|
|
|
|
|
|
|
|
|
|
|
2015-11-17 16:11:53 +00:00
|
|
|
class HelloWorldTests(unittest.TestCase):
|
2015-04-25 19:32:04 +02:00
|
|
|
|
|
|
|
|
def test_hello_without_name(self):
|
|
|
|
|
self.assertEqual(
|
2015-05-26 20:56:37 -07:00
|
|
|
'Hello, World!',
|
2015-04-25 19:32:04 +02:00
|
|
|
hello_world.hello()
|
|
|
|
|
)
|
2015-05-30 11:45:18 -07:00
|
|
|
|
2015-11-17 16:11:53 +00:00
|
|
|
def test_hello_with_sample_name(self):
|
2015-04-25 19:32:04 +02:00
|
|
|
self.assertEqual(
|
2015-11-17 16:11:53 +00:00
|
|
|
'Hello, Alice!',
|
|
|
|
|
hello_world.hello('Alice')
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def test_hello_with_other_sample_name(self):
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
'Hello, Bob!',
|
|
|
|
|
hello_world.hello('Bob')
|
2015-04-25 19:32:04 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def test_hello_with_umlaut_name(self):
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
'Hello, Jürgen!',
|
|
|
|
|
hello_world.hello('Jürgen')
|
|
|
|
|
)
|
|
|
|
|
|
2016-09-28 08:07:42 -03:00
|
|
|
def test_hello_with_blank_name(self):
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
'Hello, World!',
|
|
|
|
|
hello_world.hello('')
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def test_hello_with_none_name(self):
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
'Hello, World!',
|
|
|
|
|
hello_world.hello(None)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2015-04-25 19:32:04 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|