本文整理汇总了Python中foo.Foo方法的典型用法代码示例。如果您正苦于以下问题:Python foo.Foo方法的具体用法?Python foo.Foo怎么用?Python foo.Foo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类foo
的用法示例。
在下文中一共展示了foo.Foo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_special_cases
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_special_cases():
'''
Extraordinary cases that should still be supported
by IP.
'''
#ensure that assemblies reopening the same module and overriding
#a class work. by "work", this means that the last (alphabetically) DLL
#should be the one that's imported
import foo
AreEqual(foo.Foo().BAR, 4)
#test some unusual DLL filenames
for partial_ns in ["ZERO", "ONE", "a", "UNDERSCORE", "WHITESPACE", "BIGFILENAME"]:
mod_name = "foo" + partial_ns
exec "import " + mod_name
exec "AreEqual(" + mod_name + ".Foo().BAR, 1)"
示例2: test_special_cases
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_special_cases():
'''
Extraordinary cases that should still be supported
by IP.
'''
#ensure that assemblies reopening the same module and overriding
#a class work. by "work", this means that the last (alphabetically) DLL
#should be the one that's imported
import foo
AreEqual(foo.Foo().BAR, 4)
#test some unusual DLL filenames
for partial_ns in ["ZERO", "ONE", "a", "UNDERSCORE", "WHITESPACE", "BIGFILENAME"]:
mod_name = "foo" + partial_ns
exec("import " + mod_name)
exec("AreEqual(" + mod_name + ".Foo().BAR, 1)")
示例3: test_attribute_access
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_attribute_access(v):
v.scan(
"""\
# foo.py
class Foo:
pass
# bar.py
from foo import Foo
# main.py
import bar
bar.Foo
"""
)
check(v.defined_imports, ["Foo", "bar"])
check(v.unused_imports, [])
示例4: test_sanity
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_sanity():
'''
Sanity checks. All of these are fairly normal imports
and should work.
'''
#first check that our native modules are still present and accounted for...
import binascii
import _collections
import copy_reg
import cPickle
import cStringIO
import datetime
import errno
import exceptions
import gc
import imp
import itertools
import marshal
import math
import nt
import operator
import re
import socket
import _struct
import thread
import time
#next run through our first set of "OK" modules
for i in xrange(50):
mod_name = "foo" + str(i)
exec "import " + mod_name
exec "AreEqual(" + mod_name + ".Foo().BAR," + str(i) + ")"
示例5: test_foo
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_foo(self):
f = foo.Foo("hello")
self.assertEqual(f.get_datum(), "hello")
示例6: test_pass_foo_by_value
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_pass_foo_by_value(self):
obj = foo.SomeObject("")
f = foo.Foo("hello")
obj.set_foo_value(f)
f2 = obj.get_foo_value()
self.assertEqual(f2.get_datum(), "hello")
示例7: test_pass_foo_by_transfer_ptr
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_pass_foo_by_transfer_ptr(self):
obj = foo.SomeObject("")
f = foo.Foo("hello")
obj.set_foo_ptr(f)
del f
f2 = obj.get_foo_ptr()
self.assertEqual(f2.get_datum(), "hello")
示例8: test_pass_foo_shared_ptr
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_pass_foo_shared_ptr(self):
obj = foo.SomeObject("")
f = foo.Foo("hello")
obj.set_foo_shared_ptr(f)
self.assertEqual(f.get_datum(), "hello")
f2 = obj.get_foo_shared_ptr()
self.assertEqual(f2.get_datum(), "hello")
示例9: test_pass_by_reference
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_pass_by_reference(self):
obj = foo.SomeObject("")
f = foo.Foo("hello")
obj.set_foo_by_ref(f)
self.assertEqual(f.get_datum(), "hello")
f2 = obj.get_foo_by_ref()
self.assertEqual(f2.get_datum(), "hello")
示例10: test_custom_instance_attribute
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_custom_instance_attribute(self):
obj = foo.Foo()
if foo.Foo.instance_count == 1:
self.assertTrue(obj.is_unique)
else:
self.assertFalse(obj.is_unique)
示例11: test_return_type_narrowing
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_return_type_narrowing(self):
obj = foo.SomeObject("zbr")
obj.set_foo_ptr(foo.Foo())
foo1 = obj.get_foo_ptr()
self.assertEqual(type(foo1), foo.Foo)
bar2 = foo.Bar()
self.assertEqual(type(bar2), foo.Bar)
obj.set_foo_ptr(bar2)
foo2 = obj.get_foo_ptr()
self.assertEqual(type(foo2), foo.Bar)
示例12: test_subclass_with_virtual_with_foo_parameter_value
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_subclass_with_virtual_with_foo_parameter_value(self):
class Test(foo.SomeObject):
def __init__(self, prefix, extra_prefix):
super(Test, self).__init__(prefix)
self.extra_prefix = extra_prefix
def get_prefix_with_foo_value(self, fooval):
prefix = super(Test, self).get_prefix_with_foo_value(fooval)
return prefix + self.extra_prefix + fooval.get_datum()
t = Test("123", "456")
foo1 = foo.Foo("zbr")
prefix = t.get_prefix_with_foo_value(foo1)
self.assertEqual(prefix, "123zbr456zbr")
示例13: test_subclass_with_virtual_with_foo_parameter_ref
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_subclass_with_virtual_with_foo_parameter_ref(self):
class Test(foo.SomeObject):
def __init__(self, prefix, extra_prefix):
super(Test, self).__init__(prefix)
self.extra_prefix = extra_prefix
def get_prefix_with_foo_ref(self, fooval):
prefix = super(Test, self).get_prefix_with_foo_ref(fooval)
return prefix + self.extra_prefix + fooval.get_datum()
t = Test("123", "456")
foo1 = foo.Foo("zbr")
prefix = t.get_prefix_with_foo_ref(foo1)
self.assertEqual(prefix, "123zbr456zbr")
示例14: test_subclass_with_virtual_with_foo_parameter_ptr
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_subclass_with_virtual_with_foo_parameter_ptr(self):
class Test(foo.SomeObject):
def __init__(self, prefix, extra_prefix):
super(Test, self).__init__(prefix)
self.extra_prefix = extra_prefix
def get_prefix_with_foo_ptr(self, fooval):
prefix = super(Test, self).get_prefix_with_foo_ptr(fooval)
return prefix + self.extra_prefix + fooval.get_datum()
t = Test("123", "456")
foo1 = foo.Foo("zbr")
prefix = t.get_prefix_with_foo_ptr(foo1)
self.assertEqual(prefix, "123zbr456zbr")
示例15: test_instance_creation_function
# 需要导入模块: import foo [as 别名]
# 或者: from foo import Foo [as 别名]
def test_instance_creation_function(self):
f = foo.Foo()
self.assertTrue(f.is_initialized())
b = foo.Bar()
self.assertTrue(b.is_initialized())