当前位置: 首页>>代码示例>>Python>>正文


Python conditions.Attr类代码示例

本文整理汇总了Python中boto3.dynamodb.conditions.Attr的典型用法代码示例。如果您正苦于以下问题:Python Attr类的具体用法?Python Attr怎么用?Python Attr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Attr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_reset

    def test_reset(self):
        a = Attr("myattr")
        self.assert_condition_expression_build(a.eq("foo"), "#n0 = :v0", {"#n0": "myattr"}, {":v0": "foo"})

        self.assert_condition_expression_build(a.eq("foo"), "#n1 = :v1", {"#n1": "myattr"}, {":v1": "foo"})

        self.builder.reset()
        self.assert_condition_expression_build(a.eq("foo"), "#n0 = :v0", {"#n0": "myattr"}, {":v0": "foo"})
开发者ID:mtdowling,项目名称:boto3,代码行数:8,代码来源:test_conditions.py

示例2: test_build_or

 def test_build_or(self):
     a = Attr("myattr")
     a2 = Attr("myattr2")
     self.assert_condition_expression_build(
         a.eq("foo") | a2.eq("bar"),
         "(#n0 = :v0 OR #n1 = :v1)",
         {"#n0": "myattr", "#n1": "myattr2"},
         {":v0": "foo", ":v1": "bar"},
     )
开发者ID:mtdowling,项目名称:boto3,代码行数:9,代码来源:test_conditions.py

示例3: test_reset

    def test_reset(self):
        a = Attr('myattr')
        self.assert_condition_expression_build(
            a.eq('foo'), '#n0 = :v0', {'#n0': 'myattr'}, {':v0': 'foo'})

        self.assert_condition_expression_build(
            a.eq('foo'), '#n1 = :v1', {'#n1': 'myattr'}, {':v1': 'foo'})

        self.builder.reset()
        self.assert_condition_expression_build(
            a.eq('foo'), '#n0 = :v0', {'#n0': 'myattr'}, {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:11,代码来源:test_conditions.py

示例4: TestA

class TestA(TestK):
    def setUp(self):
        self.attr = Attr("mykey")
        self.attr2 = Attr("myotherkey")
        self.value = "foo"
        self.value2 = "foo2"

    def test_ne(self):
        self.assertEqual(self.attr.ne(self.value), NotEquals(self.attr, self.value))

    def test_is_in(self):
        self.assertEqual(self.attr.is_in([self.value]), In(self.attr, [self.value]))

    def test_exists(self):
        self.assertEqual(self.attr.exists(), AttributeExists(self.attr))

    def test_not_exists(self):
        self.assertEqual(self.attr.not_exists(), AttributeNotExists(self.attr))

    def test_contains(self):
        self.assertEqual(self.attr.contains(self.value), Contains(self.attr, self.value))

    def test_size(self):
        self.assertEqual(self.attr.size(), Size(self.attr))

    def test_attribute_type(self):
        self.assertEqual(self.attr.attribute_type(self.value), AttributeType(self.attr, self.value))
开发者ID:mtdowling,项目名称:boto3,代码行数:27,代码来源:test_conditions.py

示例5: test_build_double_nested_and_or

 def test_build_double_nested_and_or(self):
     a = Attr('myattr')
     a2 = Attr('myattr2')
     self.assert_condition_expression_build(
         (a.eq('foo') & a2.eq('foo2')) | (a.eq('bar') & a2.eq('bar2')),
         '((#n0 = :v0 AND #n1 = :v1) OR (#n2 = :v2 AND #n3 = :v3))',
         {'#n0': 'myattr', '#n1': 'myattr2', '#n2': 'myattr',
          '#n3': 'myattr2'},
         {':v0': 'foo', ':v1': 'foo2', ':v2': 'bar', ':v3': 'bar2'})
开发者ID:boto,项目名称:boto3,代码行数:9,代码来源:test_conditions.py

示例6: test_build_double_nested_and_or

 def test_build_double_nested_and_or(self):
     a = Attr("myattr")
     a2 = Attr("myattr2")
     self.assert_condition_expression_build(
         (a.eq("foo") & a2.eq("foo2")) | (a.eq("bar") & a2.eq("bar2")),
         "((#n0 = :v0 AND #n1 = :v1) OR (#n2 = :v2 AND #n3 = :v3))",
         {"#n0": "myattr", "#n1": "myattr2", "#n2": "myattr", "#n3": "myattr2"},
         {":v0": "foo", ":v1": "foo2", ":v2": "bar", ":v3": "bar2"},
     )
开发者ID:mtdowling,项目名称:boto3,代码行数:9,代码来源:test_conditions.py

示例7: test_build_size

 def test_build_size(self):
     a = Attr('myattr')
     self.assert_condition_expression_build(
         a.size(), 'size(#n0)', {'#n0': 'myattr'}, {})
开发者ID:boto,项目名称:boto3,代码行数:4,代码来源:test_conditions.py

示例8: test_build_contains

 def test_build_contains(self):
     a = Attr('myattr')
     self.assert_condition_expression_build(
         a.contains('foo'), 'contains(#n0, :v0)',
         {'#n0': 'myattr'}, {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:5,代码来源:test_conditions.py

示例9: test_build_nested_attr_map_list

 def test_build_nested_attr_map_list(self):
     a = Attr('MyMap.MyList[2].MyElement')
     self.assert_condition_expression_build(
         a.eq('foo'), '#n0.#n1[2].#n2 = :v0',
         {'#n0': 'MyMap', '#n1': 'MyList', '#n2': 'MyElement'},
         {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:6,代码来源:test_conditions.py

示例10: test_build_attribute_with_attr_value

 def test_build_attribute_with_attr_value(self):
     a = Attr('myattr')
     value = Attr('myreference')
     self.assert_condition_expression_build(
         a.eq(value), '#n0 = #n1',
         {'#n0': 'myattr', '#n1': 'myreference'}, {})
开发者ID:boto,项目名称:boto3,代码行数:6,代码来源:test_conditions.py

示例11: test_build_attr_map

 def test_build_attr_map(self):
     a = Attr('MyMap.MyKey')
     self.assert_condition_expression_build(
         a.eq('foo'), '#n0.#n1 = :v0', {'#n0': 'MyMap', '#n1': 'MyKey'},
         {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:5,代码来源:test_conditions.py

示例12: test_build_expression_lte

 def test_build_expression_lte(self):
     a1 = Attr('myattr')
     self.assert_condition_expression_build(
         a1.lte('foo'), '#n0 <= :v0', {'#n0': 'myattr'}, {':v0': 'foo'})
开发者ID:boto,项目名称:boto3,代码行数:4,代码来源:test_conditions.py

示例13: test_build_or

 def test_build_or(self):
     a = Attr('myattr')
     a2 = Attr('myattr2')
     self.assert_condition_expression_build(
         a.eq('foo') | a2.eq('bar'), '(#n0 = :v0 OR #n1 = :v1)',
         {'#n0': 'myattr', '#n1': 'myattr2'}, {':v0': 'foo', ':v1': 'bar'})
开发者ID:boto,项目名称:boto3,代码行数:6,代码来源:test_conditions.py

示例14: setUp

 def setUp(self):
     self.attr = Attr('mykey')
     self.attr2 = Attr('myotherkey')
     self.value = 'foo'
     self.value2 = 'foo2'
开发者ID:boto,项目名称:boto3,代码行数:5,代码来源:test_conditions.py

示例15: test_build_attr_map

 def test_build_attr_map(self):
     a = Attr("MyMap.MyKey")
     self.assert_condition_expression_build(
         a.eq("foo"), "#n0.#n1 = :v0", {"#n0": "MyMap", "#n1": "MyKey"}, {":v0": "foo"}
     )
开发者ID:mtdowling,项目名称:boto3,代码行数:5,代码来源:test_conditions.py


注:本文中的boto3.dynamodb.conditions.Attr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。