本文整理汇总了Python中fudge.Fake.has_attr方法的典型用法代码示例。如果您正苦于以下问题:Python Fake.has_attr方法的具体用法?Python Fake.has_attr怎么用?Python Fake.has_attr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fudge.Fake
的用法示例。
在下文中一共展示了Fake.has_attr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wrapped_column_is_sorted_via_table
# 需要导入模块: from fudge import Fake [as 别名]
# 或者: from fudge.Fake import has_attr [as 别名]
def test_wrapped_column_is_sorted_via_table():
meta = Fake().has_attr(order_by="kappa")
table = Fake().has_attr(_meta=meta)
column_a = Fake().has_attr(name="kappa")
column_b = Fake().has_attr(name="mu")
wrapped_column_a = WrappedColumn(table, column_a) # sorted
wrapped_column_b = WrappedColumn(table, column_b) # unsorted
assert wrapped_column_a.is_sorted == True
assert wrapped_column_b.is_sorted == False
assert wrapped_column_a.sort_direction == "asc"
assert wrapped_column_b.sort_direction == None
meta.has_attr(order_by="-mu")
assert wrapped_column_a.is_sorted == False
assert wrapped_column_b.is_sorted == True
assert wrapped_column_a.sort_direction == None
assert wrapped_column_b.sort_direction == "desc"
示例2: clear
# 需要导入模块: from fudge import Fake [as 别名]
# 或者: from fudge.Fake import has_attr [as 别名]
# See the License for the specific language governing permissions and
# limitations under the License.
from fudge import Fake, with_fakes, with_patched_object, clear_expectations
from fudge.inspector import arg
import cherrypy
import ion.controllers as ctrl
from ion.controllers import Controller, route, authenticated
def clear():
ctrl.__CONTROLLERS__ = []
ctrl.__CONTROLLERSDICT__ = {}
authenticated_cherrypy = Fake('cherrypy')
authenticated_cherrypy.has_attr(session={'authenticated_user':'user1'})
def test_can_create_controller():
ctrl = Controller()
assert ctrl
def test_controller_has_null_context_by_default():
ctrl = Controller()
assert not ctrl.context
def test_controller_has_null_server_by_default():
ctrl = Controller()
assert not ctrl.server