File: test_eof_jy.py

package info (click to toggle)
jython 2.5.3-16%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 43,772 kB
  • ctags: 106,434
  • sloc: python: 351,322; java: 216,349; xml: 1,584; sh: 330; perl: 114; ansic: 102; makefile: 45
file content (61 lines) | stat: -rw-r--r-- 1,662 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import unittest
from test import test_support

class TestEof(unittest.TestCase):
    """
    Oddities originally found in Django involving whitespace and newlines or
    lack thereof at the end of files.  I can't use __builtin__.compile()
    because newlines get added and hide these problems, so I have opted to
    import Python files containing these oddities.
    """

    def test_indented_no_newline(self):
        try:
            import eof_fodder1
        except ImportError, cause:
            self.fail(cause)

    def test_trailing_ws_no_newline(self):
        try:
            import eof_fodder2
        except ImportError, cause:
            self.fail(cause)

    def test_trailing_ws(self):
        try:
            import eof_fodder3
        except ImportError, cause:
            self.fail(cause)

    def test_empty(self):
        try:
            import eof_fodder4
        except ImportError, cause:
            self.fail(cause)

    def test_just_a_comment_no_newline(self):
        try:
            import eof_fodder5
        except ImportError, cause:
            self.fail(cause)

    def test_junky_ws_after_indent(self):
        try:
            import eof_fodder6
        except ImportError, cause:
            self.fail(cause)

    def test_trailing_paren(self):
        try:
            import badsyntax_eof1
        except SyntaxError, cause:
            self.assertEquals(cause.lineno, 5)

#==============================================================================

def test_main(verbose=None):
    test_classes = [TestEof]
    test_support.run_unittest(*test_classes)

if __name__ == "__main__":
    test_main(verbose=True)