當前位置: 首頁>>代碼示例>>Python>>正文


Python foo.Foo方法代碼示例

本文整理匯總了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)" 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:18,代碼來源:dllsite.py

示例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)") 
開發者ID:IronLanguages,項目名稱:ironpython3,代碼行數:18,代碼來源:dllsite.py

示例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, []) 
開發者ID:jendrikseipp,項目名稱:vulture,代碼行數:19,代碼來源:test_imports.py

示例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) + ")" 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:34,代碼來源:dllsite.py

示例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") 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:5,代碼來源:footest.py

示例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") 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:9,代碼來源:footest.py

示例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") 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:9,代碼來源:footest.py

示例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") 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:9,代碼來源:footest.py

示例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") 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:9,代碼來源:footest.py

示例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) 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:8,代碼來源:footest.py

示例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) 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:14,代碼來源:footest.py

示例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") 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:15,代碼來源:footest.py

示例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") 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:15,代碼來源:footest.py

示例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") 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:15,代碼來源:footest.py

示例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()) 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:8,代碼來源:footest.py


注:本文中的foo.Foo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。