本文整理汇总了Python中support.compare函数的典型用法代码示例。如果您正苦于以下问题:Python compare函数的具体用法?Python compare怎么用?Python compare使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了compare函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: list
import support
t = (1, 2, 3)
list(t).reverse()
support.compare(t, "1, 2, 3")
开发者ID:certik,项目名称:jython,代码行数:5,代码来源:test175.py
示例2:
import support
import test173p
support.compare(test173p, "sys")
开发者ID:certik,项目名称:jython,代码行数:5,代码来源:test173.py
示例3: test206j1
"""
"""
import support
support.compileJava("classes/test206j1.java")
import java
#import test206j0
import test206j1
x = test206j1()
support.compare(x.getInt2(), "4")
support.compare(x.getInt(), "3")
开发者ID:certik,项目名称:jython,代码行数:16,代码来源:test206.py
示例4:
"""
no exception when too many arguments for format string
"""
import support
try:
r = '%d' % (1, 2)
except TypeError, e:
support.compare(e, "not all arguments converted")
开发者ID:doom38,项目名称:jython_v2.2.1,代码行数:10,代码来源:test070.py
示例5:
"""
Check properites of the exceptions module.
"""
import support
import exceptions
support.compare(exceptions.__doc__, "standard exception class hierarchy")
support.compare(exceptions.__name__, "exceptions")
#support.compare(exceptions.__file__, r"Lib\\exceptions.py")
开发者ID:doom38,项目名称:jython_v2.2.1,代码行数:12,代码来源:test097.py
示例6:
"""
Test keywords to import builtin.
"""
import support
impl_names = ['java']
# Will only return anygui :P
try:
impls = [__import__('anygui.impl.%sgui' % name,
fromlist=['%sgui' % name]) for name in impl_names]
except TypeError, e:
support.compare(e, "__import__\(\) takes no keyword arguments");
else:
support.TestError("Should raise a TypeError")
开发者ID:certik,项目名称:jython,代码行数:16,代码来源:test291.py
示例7: mkj2
def mkj2(v):
f = open("classes/test092m/test092j2.java", "w")
f.write(j2file % v);
f.close();
support.compileJava("classes/test092m/test092j2.java")
import sys
mkj1("1")
mkj2("2")
import test092m
foo = test092m.test092j2()
support.compare(foo.j1Version, "j1 Version 1")
support.compare(foo.j2Version, "j2 Version 2")
mkj1("3")
mkj2("4")
#
# Removed. Reloading java packages is not supposed to work
#
#reload(test092m)
#
#foo = test092m.test092j2()
#support.compare(foo.j1Version, "j1 Version 3")
#support.compare(foo.j2Version, "j2 Version 4")
开发者ID:certik,项目名称:jython,代码行数:29,代码来源:test092.py
示例8: makeBlob
package com;
public class Blob {
int value = %d;
}
"""
def makeBlob(value):
f = open("test273p/com/Blob.java", "w")
f.write(src % value);
f.close();
support.compileJava(r"test273p/com/Blob.java")
support.compileJava(r"test273p/com/BlobWriter.java", classpath="test273p")
makeBlob(1)
import jreload
XLS = jreload.makeLoadSet("XLS",['test273p'])
from XLS import com
v = com.BlobWriter.write(com.Blob())
support.compare(v, "1")
makeBlob(2)
jreload.reload(XLS)
v = com.BlobWriter.write(com.Blob())
support.compare(v, "2")
开发者ID:certik,项目名称:jython,代码行数:30,代码来源:test273.py
示例9:
"""
Calling static methods in subclass.
"""
import support
support.compileJava("classes/test084j3.java")
import test084j3
r = test084j3.main(["xxx"])
support.compare(r, "test084j3")
r = test084j3.ohMy()
support.compare(r, "test084j3")
开发者ID:certik,项目名称:jython,代码行数:15,代码来源:test084.py
示例10:
"""
"""
import support
support.compileJava("classes/test208j.java")
import test208j
import test208j1
import test208j2
p=[test208j2()]
support.compare(test208j.foo(p), "test208j2\[\]")
p=[test208j1()]
support.compare(test208j.foo(p), "test208j1\[\]")
开发者ID:certik,项目名称:jython,代码行数:17,代码来源:test208.py
示例11: TableModel0
from pawt import swing, test
class TableModel0(swing.table.AbstractTableModel):
columnNames = "First Name", "Last Name","Sport","# of Years","Vegetarian"
data = [("Mary", "Campione", "Snowboarding", 5, java.lang.Boolean(0))]
def getColumnCount(self):
return len(self.columnNames)
def getRowCount(self):
return len(self.data)
def getColumnName(self, col):
return self.columnNames[col]
def getValueAt(self, row, col):
return self.data[row][col]
def getColumnClass(self, c):
return java.lang.Class.getClass(self.getValueAt(0, c))
def isCellEditable(self, row, col):
return col >= 2
model0 = TableModel0()
support.compare(model0.getColumnClass(0), "java.lang.String")
support.compare(model0.getColumnClass(1), "java.lang.String")
support.compare(model0.getColumnClass(2), "java.lang.String")
support.compare(model0.getColumnClass(3), "java.lang.Integer")
support.compare(model0.getColumnClass(4), "java.lang.Boolean")
开发者ID:certik,项目名称:jython,代码行数:30,代码来源:test104.py
示例12: Data
class Test:
text = Data()
class Factory:
def createTest(x):
return Test()
factory = Factory()
foo = factory.createTest()
from java import io
import sys
filename = "test101.out"
fout = io.ObjectOutputStream(io.FileOutputStream(filename))
fout.writeObject(foo)
fout.close()
fin = io.ObjectInputStream(io.FileInputStream(filename))
foo = fin.readObject()
fin.close()
support.compare(foo, "<(__main__|test101).Test instance")
support.compare(foo.text, "<(__main__|test101).Data instance")
support.compare(foo.text.data, "Hello World")
开发者ID:certik,项目名称:jython,代码行数:28,代码来源:test101.py
示例13: mkspam
"""
Try reloading a javaclass located on sys.path.
"""
import support
import java
import sys
def mkspam(a):
f = open("test081j.java", "w")
f.write("""
public class test081j {
public static String spam() { return "%s"; }
public static void %s() {}
}
""" % (a, a))
f.close()
support.compileJava("test081j.java")
mkspam("foo")
import test081j
spam1 = test081j.spam()
support.compare(spam1, "foo")
开发者ID:certik,项目名称:jython,代码行数:25,代码来源:test081.py
示例14: pytest
"""
import support
support.compileJava("test277p/Test.java")
from test277p import Test
cnt = 0
class pytest(Test):
def initialize(self):
global cnt
Test.initialize(self)
cnt += 1
pt = pytest()
support.compare(cnt, "2")
cnt = 0
import java
pt = java.lang.Class.newInstance(pytest)
support.compare(cnt, "2")
开发者ID:certik,项目名称:jython,代码行数:29,代码来源:test277.py
示例15:
"""
Coercion of Integer and Number.
"""
import support
support.compileJava("test091j.java")
import test091j
r = test091j.takeInt(12)
support.compare(r, "takeInt")
r = test091j.takeInteger(12)
support.compare(r, "takeInteger")
r = test091j.takeNumber(12)
support.compare(r, "takeNumber")
开发者ID:certik,项目名称:jython,代码行数:18,代码来源:test091.py
示例16: zeros
"""
"""
import support
support.compileJava("test157j.java")
import test157j
from jarray import *
f = zeros(2,'d');
support.compare(test157j.test(f), "double");
if f[0] == 0:
raise support.TestError("array not changed")
f = zeros(2,'f');
support.compare(test157j.test(f), "float");
if f[0] == 0:
raise support.TestError("array not changed")
开发者ID:certik,项目名称:jython,代码行数:21,代码来源:test157.py
示例17:
"""
"""
import support
class m:
__var = 0
try:
m.__var
except AttributeError, e:
support.compare(e, "class 'm' has no attribute '__var'")
else:
raise support.TestError("Should raise")
开发者ID:doom38,项目名称:jython_v2.2.1,代码行数:15,代码来源:test144.py
示例18: eval
"""
__file__ should not be defined when eval.
"""
import support
try:
eval('__file__')
except NameError, e:
support.compare(e, "__file__")
开发者ID:doom38,项目名称:jython_v2.2.1,代码行数:10,代码来源:test078.py
示例19:
"""
"""
import support
support.compare("%g" % 1, "1")
support.compare("%g .. %g" % (1,2), "1 .. 2")
#raise support.TestError("" + `x`)
开发者ID:certik,项目名称:jython,代码行数:10,代码来源:test165.py
示例20:
"""
"TypeError: can't instantiate abstract class" thrown for class with no public constructors
"""
import support
import java
try:
java.lang.Math()
except TypeError, e:
support.compare(e, "no public constructors for")
开发者ID:doom38,项目名称:jython_v2.2.1,代码行数:12,代码来源:test047.py
注:本文中的support.compare函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论