#-*-coding:utf-8 -*-
import
unittest
'''
def City_country(city,country):
return (city+" "+country).title()
class CityTestCase(unittest.TestCase):
def test_City_country(self):
cc=City_country("santiago","Chile")
self.assertEqual(cc,"Santiago Chile")
'''
def
City_country
(
city
,
country
,
population
):
cc
=
(city
+
" "
+
country).title()
cc
=
cc
+
" = "
+
"population "
+
str
(population)
return
cc
class
CityTestCase
(
unittest
.
TestCase
):
def
test_City_country_population
(
self
):
cc
=
City_country(
"santiago"
,
"Chile"
,
5000000
)
self
.assertEqual(cc,
"Santiago Chile = population 5000000"
)
class
Employee
():
def
__init__
(
self
,
first
,
last
,
ym
):
self
.first
=
first
self
.last
=
last
self
.ym
=
ym
def
give_raise
(
self
,
inym
=
5000
):
self
.ym
+=
inym
class
MoneyTest
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.worker
=
Employee(
"xxx"
,
"yyy"
,
5000
)
self
.worker1
=
Employee(
"xxx"
,
"yyy"
,
5000
)
self
.answer
=
[
10000
,
15000
]
def
test_give_default_raise
(
self
):
self
.worker.give_raise()
self
.worker1.give_raise(
10000
)
self
.assertEqual(
self
.worker.ym,
self
.answer[
0
])
self
.assertEqual(
self
.worker1.ym,
self
.answer[
1
])
unittest.main()