本文整理汇总了Python中x.a.b方法的典型用法代码示例。如果您正苦于以下问题:Python a.b方法的具体用法?Python a.b怎么用?Python a.b使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类x.a
的用法示例。
在下文中一共展示了a.b方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_tuple_unpack
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_tuple_unpack(self):
b = """
def foo():
try:
pass
except Exception, (f, e):
pass
except ImportError, e:
pass"""
a = """
def foo():
try:
pass
except Exception as xxx_todo_changeme:
(f, e) = xxx_todo_changeme.args
pass
except ImportError as e:
pass"""
self.check(b, a)
示例2: test_bare_except
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_bare_except(self):
b = """
try:
pass
except Exception, a:
pass
except:
pass"""
a = """
try:
pass
except Exception as a:
pass
except:
pass"""
self.check(b, a)
示例3: test_multi_fixed_excepts_before_bare_except
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_multi_fixed_excepts_before_bare_except(self):
b = """
try:
pass
except TypeError, b:
pass
except Exception, a:
pass
except:
pass"""
a = """
try:
pass
except TypeError as b:
pass
except Exception as a:
pass
except:
pass"""
self.check(b, a)
示例4: test_basic
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_basic(self):
b = """if x <> y:
pass"""
a = """if x != y:
pass"""
self.check(b, a)
示例5: test_no_spaces
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_no_spaces(self):
b = """if x<>y:
pass"""
a = """if x!=y:
pass"""
self.check(b, a)
示例6: test_chained
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_chained(self):
b = """if x<>y<>z:
pass"""
a = """if x!=y!=z:
pass"""
self.check(b, a)
示例7: test_1
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_1(self):
b = """x = d.has_key("x") or d.has_key("y")"""
a = """x = "x" in d or "y" in d"""
self.check(b, a)
示例8: test_2
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_2(self):
b = """x = a.b.c.d.has_key("x") ** 3"""
a = """x = ("x" in a.b.c.d) ** 3"""
self.check(b, a)
示例9: test_4
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_4(self):
b = """x = a.b.has_key(1 + 2).__repr__() ** -3 ** 4"""
a = """x = (1 + 2 in a.b).__repr__() ** -3 ** 4"""
self.check(b, a)
示例10: test_5
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_5(self):
b = """x = a.has_key(f or g)"""
a = """x = (f or g) in a"""
self.check(b, a)
示例11: test_6
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_6(self):
b = """x = a + b.has_key(c)"""
a = """x = a + (c in b)"""
self.check(b, a)
示例12: test_7
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_7(self):
b = """x = a.has_key(lambda: 12)"""
a = """x = (lambda: 12) in a"""
self.check(b, a)
示例13: test_8
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_8(self):
b = """x = a.has_key(a for a in b)"""
a = """x = (a for a in b) in a"""
self.check(b, a)
示例14: test_10
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_10(self):
b = """if not a.has_key(b).__repr__(): pass"""
a = """if not (b in a).__repr__(): pass"""
self.check(b, a)
示例15: test_11
# 需要导入模块: from x import a [as 别名]
# 或者: from x.a import b [as 别名]
def test_11(self):
b = """if not a.has_key(b) ** 2: pass"""
a = """if not (b in a) ** 2: pass"""
self.check(b, a)