11-1城市和国家:
def city_function(city, country):
r = city.title() + ', ' + country.title()
return r
import unittest
from city_functions import city_function
class NameTestCase(unittest.TestCase):
def test_city_country(self):
test_case = city_function('santiago', 'chile')
self.assertEqual(test_case, 'Santiago, Chile')
unittest.main()
11-3雇员:
class Employee:
def __init__(self, first_name, last_name, salary):
self.first_name = first_name
self.last_name = last_name
self.salary = int(salary)
def give_raise(self, r = 5000):
self.salary += r
import unittest
from employee import Employee
class TestEmployee(unittest.TestCase):
def