diff -r 0e25a9e25931 -r f2e4fdb3dd27 tests/test-highlight.t --- a/tests/test-highlight.t Sat Jul 06 21:48:07 2013 +0200 +++ b/tests/test-highlight.t Thu Jul 04 14:18:44 2013 +0400 @@ -137,39 +137,39 @@
line source
- -
1 #!/usr/bin/env python
-
2
-
3 """Fun with generators. Corresponding Haskell implementation:
-
4
-
5 primes = 2 : sieve [3, 5..]
-
6 where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
-
7 """
-
8
-
9 from itertools import dropwhile, ifilter, islice, count, chain
-
10
-
11 def primes():
-
12 """Generate all primes."""
-
13 def sieve(ns):
-
14 p = ns.next()
-
15 # It is important to yield *here* in order to stop the
-
16 # infinite recursion.
-
17 yield p
-
18 ns = ifilter(lambda n: n % p != 0, ns)
-
19 for n in sieve(ns):
-
20 yield n
-
21
-
22 odds = ifilter(lambda i: i % 2 == 1, count())
-
23 return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
-
24
-
25 if __name__ == "__main__":
-
26 import sys
-
27 try:
-
28 n = int(sys.argv[1])
-
29 except (ValueError, IndexError):
-
30 n = 10
-
31 p = primes()
-
32 print "The first %d primes: %s" % (n, list(islice(p, n)))
+
+  #!/usr/bin/env python
+  
+  """Fun with generators. Corresponding Haskell implementation:
+  
+  primes = 2 : sieve [3, 5..]
+      where sieve (p:ns) = p : sieve [n | n <- ns, mod n p /= 0]
+  """
+  
+  from itertools import dropwhile, ifilter, islice, count, chain
+  
+  def primes():
+      """Generate all primes."""
+      def sieve(ns):
+          p = ns.next()
+          # It is important to yield *here* in order to stop the
+          # infinite recursion.
+          yield p
+          ns = ifilter(lambda n: n % p != 0, ns)
+          for n in sieve(ns):
+              yield n
+  
+      odds = ifilter(lambda i: i % 2 == 1, count())
+      return chain([2], sieve(dropwhile(lambda n: n < 3, odds)))
+  
+  if __name__ == "__main__":
+      import sys
+      try:
+          n = int(sys.argv[1])
+      except (ValueError, IndexError):
+          n = 10
+      p = primes()
+      print "The first %d primes: %s" % (n, list(islice(p, n)))
@@ -593,17 +593,14 @@ $ hgserveget euc-jp eucjp.txt % HGENCODING=euc-jp hg serve % hgweb filerevision, html -
1 \xb5\xfe
(esc) % errors encountered $ hgserveget utf-8 eucjp.txt % HGENCODING=utf-8 hg serve % hgweb filerevision, html -
1 \xef\xbf\xbd\xef\xbf\xbd
(esc) % errors encountered $ hgserveget us-ascii eucjp.txt % HGENCODING=us-ascii hg serve % hgweb filerevision, html -
1 ??
% errors encountered $ cd ..