Differences between revisions 3 and 4
Revision 3 as of 2006-03-26 14:43:57
Size: 654
Editor: wolfg
Comment:
Revision 4 as of 2006-03-26 16:41:59
Size: 2835
Editor: wolfg
Comment:
Deletions are marked like this. Additions are marked like this.
Line 22: Line 22:

'''第一段'''
 * Despite your best efforts to write comprehensive unit tests, bugs happen. What do I mean by “bug”? A bug is a test case you haven't written yet.
 * 尽管你很努力 <!> 的^地^编写全面的单元测试,但是 bug 还是会出现。 我所说的 “bug” 是什么呢? Bug 是你还没有编写的--(一个)-- <!> 独立测试^测试用例^。

'''Example 15.1. The bug'''
 * Example 15.1. The bug
 * 例 15.1. <!> 关于^一个^ Bug

'''Example 15.1.说明1'''
 * Remember in the previous section when you kept seeing that an empty string would match the regular expression you were using to check for valid Roman numerals? Well, it turns out that this is still true for the final version of the regular expression. And that's a bug; you want an empty string to raise an InvalidRomanNumeralError exception just like any other sequence of characters that don't represent a valid Roman numeral.
 * <!> 在前面的 章节中 你 <!> 看到^你有注意到一个空字符串会匹配^ <!> 用以^那个^检查罗马数字有效性的正则表达式--(认为空字符串有效)--了吗? 对于最终版本中的正则表达式这一点仍然没有改变。这就是一个 Bug ,你希望--(对于)--空字符串能够像--(对待)--其他无效的罗马数字表示一样引发 InvalidRomanNumeralError 异常。

'''下一段'''
 * After reproducing the bug, and before fixing it, you should write a test case that fails, thus illustrating the bug.
 * 在 <!> 再现 ^重现这个^ Bug 和 <!> 去除^修复^它之前你应该编写一个 <!> 失败独立测试^会失败的测试用例^来 <!> 描述这个 Bug^说明它^。

'''Example 15.2.说明1'''
 * Pretty simple stuff here. Call fromRoman with an empty string and make sure it raises an InvalidRomanNumeralError exception. The hard part was finding the bug; now that you know about it, testing for it is the easy part.
 * 这里很简单。以空字符串调用 fromRoman 并确保 <!> ^它会^引发一个 InvalidRomanNumeralError 异常。 难点在于找出 Bug,<!> 现在你知道了它^既然你已经知道它了^,测试它就很 <!> 简单^容易^了。

2006-03-26 校对记要

TableOfContents

校对文件: roman.xml

章节: [http://www.woodpecker.org.cn/obp/diveintopython-zh-5.4/zh-cn/dist/htmlflat/diveintopython.html#roman2 第15章]

本章目录

Chapter 15. Refactoring 重构

  • 15.1. Handling bugs <!> bugs 处理 处理bug

  • 15.2. Handling changing requirements 应对 <!> 要求需求变化

  • 15.3. Refactoring <!> 重组 重构

  • 15.4. Postscript 后记
  • 15.5. Summary 小结

第15章第1节

[http://www.woodpecker.org.cn/obp/diveintopython-zh-5.4/zh-cn/dist/htmlflat/diveintopython.html#roman.bugs]

第一段

  • Despite your best efforts to write comprehensive unit tests, bugs happen. What do I mean by “bug”? A bug is a test case you haven't written yet.
  • 尽管你很努力 <!>编写全面的单元测试,但是 bug 还是会出现。 我所说的 “bug” 是什么呢? Bug 是你还没有编写的一个 <!> 独立测试测试用例

Example 15.1. The bug

  • Example 15.1. The bug
  • 例 15.1. <!> 关于一个 Bug

Example 15.1.说明1

  • Remember in the previous section when you kept seeing that an empty string would match the regular expression you were using to check for valid Roman numerals? Well, it turns out that this is still true for the final version of the regular expression. And that's a bug; you want an empty string to raise an InvalidRomanNumeralError exception just like any other sequence of characters that don't represent a valid Roman numeral.

  • <!> 在前面的 章节中 你 <!> 看到你有注意到一个空字符串会匹配 <!> 用以那个检查罗马数字有效性的正则表达式认为空字符串有效了吗? 对于最终版本中的正则表达式这一点仍然没有改变。这就是一个 Bug ,你希望对于空字符串能够像对待其他无效的罗马数字表示一样引发 InvalidRomanNumeralError 异常。

下一段

  • After reproducing the bug, and before fixing it, you should write a test case that fails, thus illustrating the bug.
  • <!> 再现 重现这个 Bug 和 <!> 去除修复它之前你应该编写一个 <!> 失败独立测试会失败的测试用例<!> 描述这个 Bug说明它

Example 15.2.说明1

  • Pretty simple stuff here. Call fromRoman with an empty string and make sure it raises an InvalidRomanNumeralError exception. The hard part was finding the bug; now that you know about it, testing for it is the easy part.

  • 这里很简单。以空字符串调用 fromRoman 并确保 <!> 它会引发一个 InvalidRomanNumeralError 异常。 难点在于找出 Bug,<!> 现在你知道了它既然你已经知道它了,测试它就很 <!> 简单容易了。

DiveIntoPythonZh/2006-03-26 (last edited 2009-12-25 07:13:55 by localhost)