Cheetah.Tests.SyntaxAndOutput module — Cheetah3 - The Python-Powered Template Engine

# Cheetah.Tests.SyntaxAndOutput module

Syntax and Output tests.

TODO - #finally - #filter - #errorCatcher - #echo - #silent

class Cheetah.Tests.SyntaxAndOutput.AssertDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #assert

  test2()

    simple #assert that fails

  test3()

    simple #assert with WS

class Cheetah.Tests.SyntaxAndOutput.AttrDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #attr with int

  test2()

    #attr with string

  test3()

    #attr with expression

  test4()

    #attr with string + WS Should gobble

  test5()

    #attr with string + WS + leading text Shouldn’t gobble

class Cheetah.Tests.SyntaxAndOutput.Backslashes(methodName='runTest')

  Bases: `OutputTest`

  convertEOLs = False
  setUp()

    Hook method for setting up the test fixture before exercising it.

  tearDown()

    Hook method for deconstructing the test fixture after testing it.

  test1()

    a single using rawstrings

  test2()

    a single using rawstrings and lots of lines

  test3()

    a single without using rawstrings

  test4()

    single line from an apache conf file

  test5()

    single line from an apache conf file with many NEWLINES

    The NEWLINES are used to make sure that MethodCompiler.commitStrConst() is handling long and short strings in the same fashion. It uses triple-quotes for strings with lots of n in them and repr(theStr) for shorter strings with only a few newlines.

  test6()

    test backslash handling in an included file

  test7()

    a single without using rawstrings plus many NEWLINES

  test8()

    Single line from an apache conf file with single quotes and many NEWLINES

class Cheetah.Tests.SyntaxAndOutput.BlockDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #block without argstring

  test10()

    single line #block 1 escaped $placeholders + more WS

  test11()

    multiline #block $ on argstring

  test12()

    single line #block with $ on methodName

  test13()

    single line #block with an arg

  test14()

    single line #block with None for content

  test15()

    single line #block with nothing for content

  test2()

    #block without argstring, gobble WS

  test3()

    #block with argstring, gobble WS

    Because blocks can be reused in multiple parts of the template arguments (!!with defaults!!) can be given.

  test4()

    #block with 2 args, gobble WS

  test5()

    #block with 2 nested blocks

    Blocks can be nested to any depth and the name of the block is optional for the #end block part: #end block OR #end block [name]

  test6()

    single line #block

  test7()

    single line #block with WS

  test8()

    single line #block 1 escaped $placeholders

  test9()

    single line #block 1 escaped $placeholders + WS

class Cheetah.Tests.SyntaxAndOutput.BreakDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #break with a #while

  test2()

    #break with a #for

class Cheetah.Tests.SyntaxAndOutput.BreakpointDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #breakpoint part way through source code

  test2()

    #breakpoint at BOF

  test3()

    #breakpoint at EOF

class Cheetah.Tests.SyntaxAndOutput.CGI(methodName='runTest')

  Bases: `OutputTest`

  CGI scripts with(out) the CGI environment and with(out) GET variables.

  convertEOLs = False
  test1()

    A regular template.

  test2()

    A CGI script.

  test3()

    A (pseudo) Webware servlet.

    This uses the Python syntax escape to set self._CHEETAH__isControlledByWebKit. We could instead do ‘#silent self._CHEETAH__isControlledByWebKit = True’, taking advantage of the fact that it will compile unchanged as long as there’s no ‘$’ in the statement. (It won’t compile with an ‘$’ because that would convert to a function call, and you can’t assign to a function call.) Because this isn’t really being called from Webware, we’d better not use any Webware services! Likewise, we’d better not call $cgiImport() because it would be misled.

  test4()

    A CGI script with a GET variable.

class Cheetah.Tests.SyntaxAndOutput.CacheDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #cache

  test2()

    simple #cache + WS

  test3()

    simple #cache … #end cache

  test4()

    2 #cache … #end cache blocks

  test5()

    nested #cache blocks

  test6()

    Make sure that partial directives don’t match

class Cheetah.Tests.SyntaxAndOutput.CallDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #call

  test2()

    simple #call + WS

  test3()

    a longer #call

  test4()

    #call with keyword #args

  test5()

    #call with single-line keyword #args

  test6()

    #call with python kwargs and cheetah output for the 1s positional arg

  test7()

    #call with python kwargs and #args

  test8()

    #call with python kwargs and #args, and using a function to get the function that will be called

  test9()

    nested #call directives

class Cheetah.Tests.SyntaxAndOutput.CaptureDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #capture

  test2()

    slightly more complex #capture

class Cheetah.Tests.SyntaxAndOutput.Comments_MultiLine(methodName='runTest')

  Bases: `OutputTest`

  Note: Multiline comments don’t gobble whitespace!

  test1()

    #* *# followed by WS Should gobble WS

  test10()

    text around #* *# containing #for directive and trailing whitespace which should be gobbled

  test11()

    Text around #* *# containing #for directive and newlines: trailing whitespace which should be gobbled.

  test2()

    #* *# preceded and followed by WS Should gobble WS

  test3()

    #* *# followed by WS, with NEWLINE Shouldn’t gobble WS

  test4()

    #* *# preceded and followed by WS, with NEWLINE Shouldn’t gobble WS

  test5()

    #* *# containing nothing

  test6()

    #* *# containing only NEWLINES

  test7()

    #* *# containing $placeholders

  test8()

    #* *# containing #for directive

  test9()

    text around #* *# containing #for directive

class Cheetah.Tests.SyntaxAndOutput.Comments_MultiLine_NoGobble(methodName='runTest')

  Bases: `OutputTest`

  Multiline comments used to not gobble whitespace

  They do now, but this can be turned off with a compilerSetting.

  test1()

    #* *# followed by WS Shouldn’t gobble WS

  test2()

    #* *# preceded and followed by WS Shouldn’t gobble WS

  test3()

    #* *# followed by WS, with NEWLINE Shouldn’t gobble WS

  test4()

    #* *# preceded and followed by WS, with NEWLINE Shouldn’t gobble WS

class Cheetah.Tests.SyntaxAndOutput.Comments_SingleLine(methodName='runTest')

  Bases: `OutputTest`

  test1()

    ## followed by WS

  test10()

    ## containing $placeholders

  test11()

    ## containing #for directive

  test2()

    ## followed by NEWLINE

  test3()

    ## followed by text then NEWLINE

  test4()

    ## gobbles leading WS

  test5()

    ## followed by text then NEWLINE, + leading WS

  test6()

    ## followed by EOF

  test7()

    ## followed by EOF with leading WS

  test8()

    ## gobble line with text on previous and following lines

  test9()

    ## don’t gobble line with text on previous and following lines

class Cheetah.Tests.SyntaxAndOutput.CompilerDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    overriding the commentStartToken

  test2()

    overriding and resetting the commentStartToken

class Cheetah.Tests.SyntaxAndOutput.CompilerSettingsDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    overriding the cheetahVarStartToken

  test2()

    overriding the directiveStartToken

  test3()

    overriding the commentStartToken

class Cheetah.Tests.SyntaxAndOutput.ContinueDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #continue with a #while

  test2()

    #continue with a #for

class Cheetah.Tests.SyntaxAndOutput.DecoratorDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    single line #def with decorator

  test2()

    #def with multiple decorators

class Cheetah.Tests.SyntaxAndOutput.DefDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #def without argstring

  test10()

    #def with *args + **KWs, gobble WS

  test11()

    single line #def with extra WS

  test12()

    single line #def with extra WS and nested $placeholders

  test13()

    single line #def escaped $placeholders

  test14()

    single line #def 1 escaped $placeholders

  test15()

    single line #def 1 escaped $placeholders + more WS

  test16()

    multiline #def with $ on methodName

  test17()

    single line #def with $ on methodName

  test18()

    single line #def with an argument

  test19()

    #def that extends over two lines with arguments

  test2()

    #def without argstring, gobble WS

  test3()

    #def with argstring, gobble WS

  test4()

    #def with argstring, gobble WS, string used in call

  test5()

    #def with argstring, gobble WS, list used in call

  test6()

    #def with 2 args, gobble WS, list used in call

  test7()

    #def with *args, gobble WS

  test8()

    #def with **KWs, gobble WS

  test9()

    #def with *args + **KWs, gobble WS

class Cheetah.Tests.SyntaxAndOutput.DefmacroDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()
  test2()

class Cheetah.Tests.SyntaxAndOutput.DummyClass

  Bases: `object`

  callIt(arg=1234)
  meth(arg='arff')
  meth1(arg='doo')
  meth2(arg1='a1', arg2='a2')
  methWithPercentSignDefaultArg(arg1='110%')

class Cheetah.Tests.SyntaxAndOutput.EOLSlurpToken(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #slurp with 1 n

  test2()

    #slurp with 1 n, leading whitespace Should gobble

  test3()

    #slurp with 1 n, leading content Shouldn’t gobble

  test4()

    #slurp with WS then n, leading content Shouldn’t gobble

  test5()

    #slurp with garbage chars then n, leading content Should NOT eat the garbage

class Cheetah.Tests.SyntaxAndOutput.EchoDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #echo 1234

class Cheetah.Tests.SyntaxAndOutput.EmptyTemplate(methodName='runTest')

  Bases: `OutputTest`

  convertEOLs = False
  test1()

    an empty string for the template

class Cheetah.Tests.SyntaxAndOutput.EncodingDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    basic #encoding

  test2()

    basic #encoding

  test3()

    basic #encoding

  test4()

    basic #encoding

  test5()

    basic #encoding

  test6()

    Using #encoding on the second line

class Cheetah.Tests.SyntaxAndOutput.ErrorCatcherDirective(methodName='runTest')

  Bases: `OutputTest`

class Cheetah.Tests.SyntaxAndOutput.ExtendsDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #extends Cheetah.Templates._SkeletonPage

  test2()

    #extends Cheetah.Templates.SkeletonPage without #import

  test3()

    #extends Cheetah.Templates.SkeletonPage.SkeletonPage without #import

  test4()

    #extends with globals and searchList test

class Cheetah.Tests.SyntaxAndOutput.FilterDirective(methodName='runTest')

  Bases: `OutputTest`

  convertEOLs = False
  test1()

    #filter Filter

  test10()

    #filter Strip – multi-line

  test11()

    #filter StripSqueeze – canonicalize all whitespace to ‘ ‘

  test2()

    #filter ReplaceNone with WS

  test3()

    #filter MaxLen – maxlen of 5

  test4()

    #filter MaxLen – no maxlen

  test5()

    #filter WebSafe – basic usage

  test6()

    #filter WebSafe – also space

  test7()

    #filter WebSafe – also space, without $ on the args

  test8()

    #filter Strip – trailing newline

  test9()

    #filter Strip – no trailing newine

class Cheetah.Tests.SyntaxAndOutput.ForDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #for loop with one local var

  test10()

    #for loop over list, using methods of the items

  test11()

    #for loop over list, using ($i,$j) style target list

  test12()

    #for loop over list, using i, (j,k) style target list

  test13()

    single line #for

  test14()

    single line #for with 1 extra leading space

  test15()

    2 times single line #for

  test16()

    false single line #for

  test2()

    #for loop with WS in loop

  test3()

    #for loop gobble WS

  test4()

    #for loop over list

  test5()

    #for loop over list, with #slurp

  test6()

    #for loop with explicit closures

  test7()

    #for loop with explicit closures and WS

  test8()

    #for loop using another $var

  test9()

    test methods in for loops

class Cheetah.Tests.SyntaxAndOutput.GetVar(methodName='runTest')

  Bases: `OutputTest`

  test1()

    $getVar(‘$anInt’)

  test2()

    $getVar(‘anInt’)

  test3()

    $self.getVar(‘anInt’)

  test4()

    $getVar(‘bogus’, 1234)

  test5()

    $getVar(‘$bogus’, 1234)

  test6()

    $getVar(‘$’) raises ValueError or NotFound(LookupError)

class Cheetah.Tests.SyntaxAndOutput.I18nDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #call

class Cheetah.Tests.SyntaxAndOutput.IfDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #if block

  test10()

    #if block using $*emptyString

    This should barf

  test11()

    #if block using invalid top-level $(placeholder) syntax - should barf

  test12()

    #if … #else if … #else … block using a $emptyString Same as test 8 but using else if instead of elif

  test13()

    #if# … #else # … block using a $emptyString with

  test14()

    single-line #if: simple

  test15()

    single-line #if: more complex

  test16()

    single-line #if: with the words ‘else’ and ‘then’ in the output

  test17()

    single-line #if:

  test18()

    single-line #if: #else:

  test2()

    simple #if block, with WS

  test3()

    simple #if block, with WS and explicit closures

  test4()

    #if block using $numOne

  test5()

    #if block using $zero

  test6()

    #if block using $emptyString

  test7()

    #if … #else … block using a $emptyString

  test8()

    #if … #elif … #else … block using a $emptyString

  test9()

    #if ‘not’ test, with #slurp

class Cheetah.Tests.SyntaxAndOutput.ImportDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #import math

  test10()

    #import os.path – use it with NameMapper turned off

  test11()

    #from math import *

  test2()

    #import math + WS

    Should gobble

  test3()

    #import math + WS + leading text

    Shouldn’t gobble

  test4()

    #from math import syn

  test5()

    #from math import cos + WS Should gobble

  test6()

    #from math import cos + WS + leading text Shouldn’t gobble

  test7()

    #from math import cos – use it

  test8()

    #from math import cos,tan,sin – and use them

  test9()

    #import os.path – use it

class Cheetah.Tests.SyntaxAndOutput.ImportantExampleCases(methodName='runTest')

  Bases: `OutputTest`

  test1()

    how to make a comma-delimited list

class Cheetah.Tests.SyntaxAndOutput.IncludeDirective(methodName='runTest')

  Bases: `OutputTest`

  setUp()

    Hook method for setting up the test fixture before exercising it.

  tearDown()

    Hook method for deconstructing the test fixture after testing it.

  test1()

    #include raw of source $emptyString

  test10()

    #include of “parseTest.txt”, with WS

  test11()

    #include of ‘parseTest.txt’, with WS and surrounding text

  test12()

    #include of ‘parseTest.txt’, with WS and explicit closure

  test2()

    #include raw of source $blockToBeParsed

  test3()

    #include raw of ‘parseTest.txt’

  test4()

    #include raw of $includeFileName

  test5()

    #include raw of $includeFileName, with WS

  test6()

    #include raw of source= , with WS

  test7()

    #include of $blockToBeParsed

  test8()

    #include of $blockToBeParsed, with WS

  test9()

    #include of ‘parseTest.txt’, with WS

class Cheetah.Tests.SyntaxAndOutput.Indenter(methodName='runTest')

  Bases: `OutputTest`

  control = '\npublic class X\n{\n public void Foo(\n _input,\n _output);\n\n\n public int Bar(\n _str1,\n str2,\n _str3);\n\n\n public Object Add(\n value1,\n value);\n\n\n}\n//end of class\n\n\n\n'
  convertEOLs = False
  searchList()
  source = '\npublic class X\n{\n #for $method in $methods\n $getMethod($method)\n\n #end for\n}\n//end of class\n\n#def getMethod($method)\n #indent ++\n public $getType($method) ${method.Name}($getParams($method.Params));\n #indent --\n#end def\n\n#def getParams($params)\n #indent off\n\n #for $counter in $range($len($params))\n #if $counter == len($params) - 1\n $params[$counter]#slurp\n #else:\n $params[$counter],\n #end if\n #end for\n #indent on\n#end def\n\n#def getType($method)\n #indent push\n #indent=0\n #if $method.Type == "VT_VOID"\n void#slurp\n #elif $method.Type == "VT_INT"\n int#slurp\n #elif $method.Type == "VT_VARIANT"\n Object#slurp\n #end if\n #indent pop\n#end def\n'
  test1()

class Cheetah.Tests.SyntaxAndOutput.MiscComplexSyntax(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #set $c = {‘A’:0}[{}.get(‘a’, {‘a’ : ‘A’}[‘a’])] $c

class Cheetah.Tests.SyntaxAndOutput.NameMapper(methodName='runTest')

  Bases: `OutputTest`

  test1()

    autocalling

  test10()

    nested dictionary access - NameMapper style

  test11()

    nested dictionary access - Python style

  test12()

    nested dictionary access - alternating style

  test13()

    nested dictionary access using method - alternating style

  test14()

    nested dictionary access - NameMapper style - followed by method

  test15()

    nested dictionary access - alternating style - followed by method

  test16()

    Nested dictionary access - NameMapper style - followed by method, then slice.

  test17()

    nested dictionary access - Python style using a soft-coded key

  test18()

    object method access

  test19()

    object method access, followed by complex slice

  test2()

    nested autocalling

  test20()

    object method access, followed by a very complex slice If it can pass this one, it’s safe to say it works!!

  test21()

    object method access with % in the default arg for the meth.

    This tests a bug that Jeff Johnson found and submitted a patch to SF for.

  test3()

    list subscription

  test4()

    list slicing

  test5()

    list slicing and subcription combined

  test6()

    dictionary access - NameMapper style

  test7()

    dictionary access - Python style

  test8()

    dictionary access combined with autocalled string method

  test9()

    dictionary access combined with string method

class Cheetah.Tests.SyntaxAndOutput.NonTokens(methodName='runTest')

  Bases: `OutputTest`

  test1()

    dollar signs not in Cheetah $vars

  test2()

    hash not in #directives

  test3()

    escapted comments

  test4()

    escapted multi-line comments

  test5()

    1 dollar sign

  test6()

    1 dollar sign followed by EOL Slurp Token

class Cheetah.Tests.SyntaxAndOutput.OutputTest(methodName='runTest')

  Bases: `TestCase`

  DEBUGLEV = 0
  convertEOLs = True
  genClassCode()
  genModuleCode()
  report = '\nTemplate output mismatch:\n\n Input Template =\n%(template)s%(end)s\n\n Expected Output =\n%(expected)s%(end)s\n\n Actual Output =\n%(actual)s%(end)s'
  searchList()
  verify(input, expectedOutput, inputEncoding=None, outputEncoding=None, convertEOLs=<class 'Cheetah.Tests.SyntaxAndOutput.Unspecified'>)

class Cheetah.Tests.SyntaxAndOutput.PSP(methodName='runTest')

  Bases: `OutputTest`

  searchList()
  test1()

    simple <%= [int] %>

  test10()

    Using getVar and write within a PSP

  test2()

    simple <%= [string] %>

  test3()

    simple <%= None %>

  test4()

    simple <%= [string] %> + $anInt

  test5()

    simple <%= [EXPR] %> + $anInt

  test6()

    for loop in <%%>

  test7()

    for loop in <%%> and using <%=i%>

  test8()

    for loop in <% $%> and using <%=i%>

  test9()

    for loop in <% $%> and using <%=i%> plus extra text

class Cheetah.Tests.SyntaxAndOutput.PassDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #pass in a #try / #except block

  test2()

    #pass in a #try / #except block + WS

class Cheetah.Tests.SyntaxAndOutput.PlaceholderStrings(methodName='runTest')

  Bases: `OutputTest`

  test1()

    some c’text $placeholder text’ strings

  test2()

    some c’text $placeholder text’ strings

  test3()

    some c’text $placeholder text’ strings

  test4()

    some c’text $placeholder text’ strings

  test5()

    some c’text $placeholder text’ strings

  test6()

    some c’text $placeholder text’ strings

  test7()

    some c’text $placeholder text’ strings

class Cheetah.Tests.SyntaxAndOutput.Placeholders(methodName='runTest')

  Bases: `OutputTest`

  test1()

    1 placeholder

  test10()

    1 placeholder enclosed in () + WS + * cache

    Test to make sure that $*(<WS><identifier>.. matches

  test11()

    1 placeholder enclosed in {} + WS + *cache

  test12()

    1 placeholder enclosed in [] + WS + *cache

  test13()

    1 placeholder enclosed in {} + WS + *<int>*cache

  test14()

    1 placeholder enclosed in [] + WS + *<int>*cache

  test15()

    1 placeholder enclosed in {} + WS + *<float>*cache

  test16()

    1 placeholder enclosed in [] + WS + *<float>*cache

  test17()

    1 placeholder + *<int>*cache

  test18()

    1 placeholder *<float>*cache

  test19()

    1 placeholder surrounded by single quotes and multiple newlines

  test2()

    2 placeholders

  test20()

    silent mode $!placeholders

  test21()

    Make sure that $*caching is actually working

  test3()

    2 placeholders, back-to-back

  test4()

    1 placeholder enclosed in ()

  test5()

    1 placeholder enclosed in {}

  test6()

    1 placeholder enclosed in []

  test7()

    1 placeholder enclosed in () + WS

    Test to make sure that $(<WS><identifier>.. matches

  test8()

    1 placeholder enclosed in {} + WS

  test9()

    1 placeholder enclosed in [] + WS

class Cheetah.Tests.SyntaxAndOutput.Placeholders_Calls(methodName='runTest')

  Bases: `OutputTest`

  test1()

    func placeholder - no ()

  test10()

    func placeholder - with (‘’’nstringn’’’)

  test11()

    func placeholder - with (‘’’nstring’n’’’)

  test12()

    func placeholder - with (“””nstringn”””)

  test13()

    func placeholder - with (string*int)

  test14()

    func placeholder - with (int*int)

  test15()

    func placeholder - with (int*float)

  test16()

    func placeholder - with (intn*nfloat)

  test17()

    func placeholder - with ($arg=float)

  test18()

    func placeholder - with (arg=float)

  test19()

    deeply nested argstring, no enclosure

  test2()

    func placeholder - with ()

  test20()

    deeply nested argstring, no enclosure + with WS

  test21()

    deeply nested argstring, () enclosure + with WS

  test22()

    deeply nested argstring, {} enclosure + with WS

  test23()

    deeply nested argstring, [] enclosure + with WS

  test24()

    deeply nested argstring, () enclosure + *cache

  test25()

    deeply nested argstring, () enclosure + *15*cache

  test26()

    a function call with the Python None kw.

  test3()

    func placeholder - with (nn)

  test4()

    func placeholder - with (nn) and $() enclosure

  test5()

    func placeholder - with (nn) and ${} enclosure

  test6()

    func placeholder - with (int)

  test7()

    func placeholder - with (nintn)

  test8()

    func placeholder - with (string)

  test9()

    func placeholder - with (‘’’string’’’)

class Cheetah.Tests.SyntaxAndOutput.Placeholders_Esc(methodName='runTest')

  Bases: `OutputTest`

  convertEOLs = False
  test1()

    1 escaped placeholder

  test2()

    2 escaped placeholders

  test3()

    2 escaped placeholders - back to back

  test4()

    2 escaped placeholders - nested

  test5()

    2 escaped placeholders - nested and enclosed

class Cheetah.Tests.SyntaxAndOutput.Placeholders_Vals(methodName='runTest')

  Bases: `OutputTest`

  convertEOLs = False
  test1()

    string

  test2()

    string - with whitespace

  test3()

    empty string - with whitespace

  test4()

    int

  test5()

    float

  test6()

    list

  test7()

    None

    The default output filter is ReplaceNone.

  test8()

    True, False

  test9()

    $_

class Cheetah.Tests.SyntaxAndOutput.RaiseDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #raise ValueError

    Should raise ValueError

  test2()

    #raise ValueError in #if block

    Should raise ValueError

  test3()

    #raise ValueError in #if block

    Shouldn’t raise ValueError

class Cheetah.Tests.SyntaxAndOutput.RawDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #raw till EOF

  test2()

    #raw till #end raw

  test3()

    #raw till #end raw gobble WS

  test4()

    #raw till #end raw using explicit directive closure Shouldn’t gobble

  test5()

    single-line short form #raw:

  test6()

    Escape characters in a #raw block

class Cheetah.Tests.SyntaxAndOutput.RepeatDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    basic #repeat

  test2()

    #repeat with numeric expression

  test3()

    #repeat with placeholder

  test4()

    #repeat with placeholder * num

  test5()

    #repeat with placeholder and WS

  test6()

    single-line #repeat

class Cheetah.Tests.SyntaxAndOutput.ReturnDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #return’ing an int

  test2()

    #return’ing an string

  test3()

    #return’ing an string AND streaming other output via the transaction

class Cheetah.Tests.SyntaxAndOutput.SetDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #set

  test10()

    simple #set global with a list

  test11()

    simple #set global with a list and *cache

    Caching only works with global #set vars. Local vars are not accesible to the cache namespace.

  test12()

    simple #set global with a list and *<int>*cache

  test13()

    simple #set with a list and *<float>*cache

  test14()

    simple #set without NameMapper on

  test15()

    simple #set without $

  test16()

    simple #set global without $

  test17()

    simple #set module without $

  test18()

    #set with i,j=list style assignment

  test19()

    #set with (i,j)=list style assignment

  test2()

    simple #set with no WS between operands

  test20()

    #set with i, (j,k)=list style assignment

  test3()

    #set + use of var

  test4()

    #set + use in an #include

  test5()

    #set with a dictionary

  test6()

    #set with string, then used in #if block

  test7()

    simple #set, gobble WS

  test8()

    simple #set, don’t gobble WS

  test9()

    simple #set with a list

class Cheetah.Tests.SyntaxAndOutput.SilentDirective(methodName='runTest')

  Bases: `OutputTest`

  test4()

    #silent 1234

class Cheetah.Tests.SyntaxAndOutput.SlurpDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #slurp with 1 n

  test2()

    #slurp with 1 n, leading whitespace Should gobble

  test3()

    #slurp with 1 n, leading content Shouldn’t gobble

  test4()

    #slurp with WS then n, leading content Shouldn’t gobble

  test5()

    #slurp with garbage chars then n, leading content Should eat the garbage

class Cheetah.Tests.SyntaxAndOutput.StopDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #stop part way through source code

  test2()

    #stop at BOF

  test3()

    #stop at EOF

  test4()

    #stop in pos test block

  test5()

    #stop in neg test block

class Cheetah.Tests.SyntaxAndOutput.SuperDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

class Cheetah.Tests.SyntaxAndOutput.TryDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #try

  test2()

    #try / #except with #raise

  test3()

    #try / #except with #raise + WS

    Should gobble

  test4()

    #try / #except with #raise + WS and leading text

    Shouldn’t gobble

  test5()

    nested #try / #except with #raise

class Cheetah.Tests.SyntaxAndOutput.UnicodeDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    basic #unicode

class Cheetah.Tests.SyntaxAndOutput.UnicodeStrings(methodName='runTest')

  Bases: `OutputTest`

  test1()

    unicode data in placeholder

  test2()

    unicode data in body

class Cheetah.Tests.SyntaxAndOutput.UnlessDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    #unless 1

  test2()

    #unless 0

  test3()

    #unless $none

  test4()

    #unless $numTwo

  test5()

    #unless $numTwo with WS

  test6()

    single-line #unless

class Cheetah.Tests.SyntaxAndOutput.Unspecified

  Bases: `object`

class Cheetah.Tests.SyntaxAndOutput.VarExists(methodName='runTest')

  Bases: `OutputTest`

  test1()

    $varExists(‘$anInt’)

  test2()

    $varExists(‘anInt’)

  test3()

    $varExists(‘$anInt’)

  test4()

    $varExists(‘$anInt’) combined with #if false

  test5()

    $varExists(‘$anInt’) combined with #if true

class Cheetah.Tests.SyntaxAndOutput.WhileDirective(methodName='runTest')

  Bases: `OutputTest`

  test1()

    simple #while with a counter

class Cheetah.Tests.SyntaxAndOutput.WhitespaceAfterDirectiveTokens(methodName='runTest')

  Bases: `OutputTest`

  test1()

class Cheetah.Tests.SyntaxAndOutput.YieldDirective(methodName='runTest')

  Bases: `OutputTest`

  convertEOLs = False
  test1()

    simple #yield

Cheetah.Tests.SyntaxAndOutput.dummyFunc(arg='Scooby')

Cheetah.Tests.SyntaxAndOutput.install_eols()

Cheetah.Tests.SyntaxAndOutput.testdecorator(func)