[Zope3-checkins] CVS: Zope3/src/zope/tal/tests - test_talinterpreter.py:1.3.6.4

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 20 17:50:48 EDT 2003


Update of /cvs-repository/Zope3/src/zope/tal/tests
In directory cvs.zope.org:/tmp/cvs-serv24655/src/zope/tal/tests

Modified Files:
      Tag: srichter-inlinepython-branch
	test_talinterpreter.py 
Log Message:
'type' is the correct attribute name in script. It also requires that the
value is a content type, so I changed everything to "text/server-python".

Also, now the type attribute value *must* start with "text/server-" for the
TAL interpreter to kick in.


=== Zope3/src/zope/tal/tests/test_talinterpreter.py 1.3.6.3 => 1.3.6.4 ===
--- Zope3/src/zope/tal/tests/test_talinterpreter.py:1.3.6.3	Wed Aug 20 16:16:18 2003
+++ Zope3/src/zope/tal/tests/test_talinterpreter.py	Wed Aug 20 16:50:48 2003
@@ -73,19 +73,19 @@
 
     def test_simple(self):
         program, macros = self._compile(
-            '<p tal:script="server-python">print "hello"</p>')
+            '<p tal:script="text/server-python">print "hello"</p>')
         self._check(program, '<p>hello\n</p>\n')
 
     def test_indent(self):
         program, macros = self._compile(
-            '<p tal:script="server-python">\n'
+            '<p tal:script="text/server-python">\n'
             '  print "hello"\n'
             '</p>')
         self._check(program, '<p>hello\n</p>\n')
 
     def test_multiline(self):
         program, macros = self._compile(
-            '<p tal:script="server-python">\n'
+            '<p tal:script="text/server-python">\n'
             '  print "hello"\n'
             '  print "world"\n'
             '</p>')
@@ -93,7 +93,7 @@
 
     def test_variable_assignment(self):
         program, macros = self._compile(
-            '<p tal:script="server-python">\n'
+            '<p tal:script="text/server-python">\n'
             '  x = 1\n'
             '  print x'
             '</p>')
@@ -101,7 +101,7 @@
 
     def test_local_variable_assignment(self):
         program, macros = self._compile(
-            '<p tal:script="server-python">\n'
+            '<p tal:script="text/server-python">\n'
             '  x = 1\n'
             '</p>')
         self._check(program, '<p></p>\n')
@@ -109,7 +109,7 @@
 
     def test_global_variable_assignment(self):
         program, macros = self._compile(
-            '<p tal:script="server-python">\n'
+            '<p tal:script="text/server-python">\n'
             '  global x\n'
             '  x = 1\n'
             '</p>')
@@ -118,7 +118,7 @@
 
     def test_use_global_variables_outside(self):
         program, macros = self._compile(
-            '<p tal:script="server-python">\n'
+            '<p tal:script="text/server-python">\n'
             '  global x\n'
             '  x = 1\n'
             '</p>\n'
@@ -128,7 +128,7 @@
 
     def test_script_and_tal_block(self):
         program, macros = self._compile(
-            '<tal:block script="server-python">\n'
+            '<tal:block script="text/server-python">\n'
             '  global x\n'
             '  x = 1\n'
             '</tal:block>\n'
@@ -138,38 +138,48 @@
 
     def test_script_and_tal_block_having_inside_print(self):
         program, macros = self._compile(
-            '<tal:block script="server-python">\n'
+            '<tal:block script="text/server-python">\n'
             '  print "hello"'
             '</tal:block>')
         self._check(program, 'hello\n\n')
 
     def test_script_and_omittag(self):
         program, macros = self._compile(
-            '<p tal:omit-tag="" tal:script="server-python">\n'
+            '<p tal:omit-tag="" tal:script="text/server-python">\n'
             '  print "hello"'
             '</p>')
         self._check(program, 'hello\n\n')
 
     def test_script_and_inside_tags(self):
         program, macros = self._compile(
-            '<p tal:omit-tag="" tal:script="server-python">\n'
+            '<p tal:omit-tag="" tal:script="text/server-python">\n'
             '  print "<b>hello</b>"'
             '</p>')
         self._check(program, '<b>hello</b>\n\n')
 
     def test_script_and_inside_tags_with_tal(self):
         program, macros = self._compile(
-            '<p tal:omit-tag="" tal:script="server-python"> <!--\n'
+            '<p tal:omit-tag="" tal:script="text/server-python"> <!--\n'
             '  print """<b tal:replace="string:foo">hello</b>"""\n'
             '--></p>')
         self._check(program, '<b tal:replace="string:foo">hello</b>\n\n')
 
     def test_html_script(self):
         program, macros = self._compile(
-            '<script lang="server-python">\n'
+            '<script type="text/server-python">\n'
             '  print "Hello world!"\n'
             '</script>')
         self._check(program, 'Hello world!\n')
+
+    def test_html_script_and_javascript(self):
+        program, macros = self._compile(
+            '<script type="text/javascript" src="somefile.js" />\n'
+            '<script type="text/server-python">\n'
+            '  print "Hello world!"\n'
+            '</script>')
+        self._check(program,
+                    '<script type="text/javascript" src="somefile.js" />\n'
+                    'Hello world!\n')
 
 
 class I18NCornerTestCase(TestCaseBase):




More information about the Zope3-Checkins mailing list