当我开始学习如何测试一个程序时,我学到的就是用与测试程序相同的语言使用一个库或包。例如,
- if a tested program is written in Python, its testing program is also written in Python and uses `UnitTest` class in the python standard library
- if a tested program is written in C++, its testing program is also written in C++ and uses some test
目前我正在学习Objective-C2。我知道Mac开发人员大量使用它,但目前我对学习这门语言比在Mac OS X/iPhone上进行开发的框架更感兴趣(除了Foundation)。为了做到这一点,我想写几个中间*控制台应用程序,但我被困在了想法上。
大多数示例都是这样的:“编写一个具有getter/setter和print函数的分数类”,这对于C++背景来说并不是很有挑战性。我想要一些通用的程序示例,但我不希望它们包含任何Objective-C实现细节。我想弄清楚程序结构/编写我自己的接口,并从那里学习语言。
总之:我很好奇Objective-C程序员会推荐什么样的示例程序来探索这门语言。
我正在使用工具来翻译我的应用程序中的一些字符串。代码如下所示:
from django.utils.translation import ugettext as _
def my_view(request):
output = _("Welcome to my site.")
return HttpResponse(output)
然后,我使用编写单元测试。这些测试向视图发出请求,并比较返回的内容。
如何在运行单元测试时禁用转换?我的目标是这样做:
class FoobarTestCase(unittest.TestCase):
def setUp(se