Best Python code snippet using assertpy_python
filter.py
Source:filter.py
1# coding: utf-82# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.3# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.4from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel # noqa: F4015from oci.decorators import init_model_state_from_kwargs6@init_model_state_from_kwargs7class Filter(object):8 """9 Query builder filter action to apply edit to queryString.10 """11 #: A constant which can be used with the operator property of a Filter.12 #: This constant has a value of "CLEAR"13 OPERATOR_CLEAR = "CLEAR"14 #: A constant which can be used with the operator property of a Filter.15 #: This constant has a value of "REPLACE"16 OPERATOR_REPLACE = "REPLACE"17 #: A constant which can be used with the operator property of a Filter.18 #: This constant has a value of "EQUALS"19 OPERATOR_EQUALS = "EQUALS"20 #: A constant which can be used with the operator property of a Filter.21 #: This constant has a value of "NOT_EQUALS"22 OPERATOR_NOT_EQUALS = "NOT_EQUALS"23 #: A constant which can be used with the operator property of a Filter.24 #: This constant has a value of "STARTS_WITH"25 OPERATOR_STARTS_WITH = "STARTS_WITH"26 #: A constant which can be used with the operator property of a Filter.27 #: This constant has a value of "DOES_NOT_START_WITH"28 OPERATOR_DOES_NOT_START_WITH = "DOES_NOT_START_WITH"29 #: A constant which can be used with the operator property of a Filter.30 #: This constant has a value of "ENDS_WITH"31 OPERATOR_ENDS_WITH = "ENDS_WITH"32 #: A constant which can be used with the operator property of a Filter.33 #: This constant has a value of "DOES_NOT_END_WITH"34 OPERATOR_DOES_NOT_END_WITH = "DOES_NOT_END_WITH"35 #: A constant which can be used with the operator property of a Filter.36 #: This constant has a value of "CONTAINS"37 OPERATOR_CONTAINS = "CONTAINS"38 #: A constant which can be used with the operator property of a Filter.39 #: This constant has a value of "DOES_NOT_CONTAIN"40 OPERATOR_DOES_NOT_CONTAIN = "DOES_NOT_CONTAIN"41 #: A constant which can be used with the operator property of a Filter.42 #: This constant has a value of "IS_LESS_THAN"43 OPERATOR_IS_LESS_THAN = "IS_LESS_THAN"44 #: A constant which can be used with the operator property of a Filter.45 #: This constant has a value of "IS_LESS_THAN_OR_EQUAL_TO"46 OPERATOR_IS_LESS_THAN_OR_EQUAL_TO = "IS_LESS_THAN_OR_EQUAL_TO"47 #: A constant which can be used with the operator property of a Filter.48 #: This constant has a value of "IS_GREATER_THAN"49 OPERATOR_IS_GREATER_THAN = "IS_GREATER_THAN"50 #: A constant which can be used with the operator property of a Filter.51 #: This constant has a value of "IS_GREATER_THAN_OR_EQUAL_TO"52 OPERATOR_IS_GREATER_THAN_OR_EQUAL_TO = "IS_GREATER_THAN_OR_EQUAL_TO"53 #: A constant which can be used with the operator property of a Filter.54 #: This constant has a value of "IS_BETWEEN"55 OPERATOR_IS_BETWEEN = "IS_BETWEEN"56 #: A constant which can be used with the operator property of a Filter.57 #: This constant has a value of "IS_NOT_BETWEEN"58 OPERATOR_IS_NOT_BETWEEN = "IS_NOT_BETWEEN"59 #: A constant which can be used with the operator property of a Filter.60 #: This constant has a value of "ADD_SUBQUERY"61 OPERATOR_ADD_SUBQUERY = "ADD_SUBQUERY"62 #: A constant which can be used with the operator property of a Filter.63 #: This constant has a value of "CLEAR_SUBQUERY"64 OPERATOR_CLEAR_SUBQUERY = "CLEAR_SUBQUERY"65 def __init__(self, **kwargs):66 """67 Initializes a new Filter object with values from keyword arguments.68 The following keyword arguments are supported (corresponding to the getters/setters of this class):69 :param field_name:70 The value to assign to the field_name property of this Filter.71 :type field_name: str72 :param values:73 The value to assign to the values property of this Filter.74 :type values: list[object]75 :param operator:76 The value to assign to the operator property of this Filter.77 Allowed values for this property are: "CLEAR", "REPLACE", "EQUALS", "NOT_EQUALS", "STARTS_WITH", "DOES_NOT_START_WITH", "ENDS_WITH", "DOES_NOT_END_WITH", "CONTAINS", "DOES_NOT_CONTAIN", "IS_LESS_THAN", "IS_LESS_THAN_OR_EQUAL_TO", "IS_GREATER_THAN", "IS_GREATER_THAN_OR_EQUAL_TO", "IS_BETWEEN", "IS_NOT_BETWEEN", "ADD_SUBQUERY", "CLEAR_SUBQUERY"78 :type operator: str79 """80 self.swagger_types = {81 'field_name': 'str',82 'values': 'list[object]',83 'operator': 'str'84 }85 self.attribute_map = {86 'field_name': 'fieldName',87 'values': 'values',88 'operator': 'operator'89 }90 self._field_name = None91 self._values = None92 self._operator = None93 @property94 def field_name(self):95 """96 Gets the field_name of this Filter.97 Field filter references when inserting filter into the query string. Field must be a valid logging analytics out-of-the-box field, virtual field calculated in the query or a user defined field.98 :return: The field_name of this Filter.99 :rtype: str100 """101 return self._field_name102 @field_name.setter103 def field_name(self, field_name):104 """105 Sets the field_name of this Filter.106 Field filter references when inserting filter into the query string. Field must be a valid logging analytics out-of-the-box field, virtual field calculated in the query or a user defined field.107 :param field_name: The field_name of this Filter.108 :type: str109 """110 self._field_name = field_name111 @property112 def values(self):113 """114 Gets the values of this Filter.115 Field values that will be inserted into the query string for the specified fieldName. Please note all values should reflect the fields data type otherwise the insert is subject to fail.116 :return: The values of this Filter.117 :rtype: list[object]118 """119 return self._values120 @values.setter121 def values(self, values):122 """123 Sets the values of this Filter.124 Field values that will be inserted into the query string for the specified fieldName. Please note all values should reflect the fields data type otherwise the insert is subject to fail.125 :param values: The values of this Filter.126 :type: list[object]127 """128 self._values = values129 @property130 def operator(self):131 """132 **[Required]** Gets the operator of this Filter.133 Operator to apply when editing the query string.134 Allowed values for this property are: "CLEAR", "REPLACE", "EQUALS", "NOT_EQUALS", "STARTS_WITH", "DOES_NOT_START_WITH", "ENDS_WITH", "DOES_NOT_END_WITH", "CONTAINS", "DOES_NOT_CONTAIN", "IS_LESS_THAN", "IS_LESS_THAN_OR_EQUAL_TO", "IS_GREATER_THAN", "IS_GREATER_THAN_OR_EQUAL_TO", "IS_BETWEEN", "IS_NOT_BETWEEN", "ADD_SUBQUERY", "CLEAR_SUBQUERY"135 :return: The operator of this Filter.136 :rtype: str137 """138 return self._operator139 @operator.setter140 def operator(self, operator):141 """142 Sets the operator of this Filter.143 Operator to apply when editing the query string.144 :param operator: The operator of this Filter.145 :type: str146 """147 allowed_values = ["CLEAR", "REPLACE", "EQUALS", "NOT_EQUALS", "STARTS_WITH", "DOES_NOT_START_WITH", "ENDS_WITH", "DOES_NOT_END_WITH", "CONTAINS", "DOES_NOT_CONTAIN", "IS_LESS_THAN", "IS_LESS_THAN_OR_EQUAL_TO", "IS_GREATER_THAN", "IS_GREATER_THAN_OR_EQUAL_TO", "IS_BETWEEN", "IS_NOT_BETWEEN", "ADD_SUBQUERY", "CLEAR_SUBQUERY"]148 if not value_allowed_none_or_none_sentinel(operator, allowed_values):149 raise ValueError(150 "Invalid value for `operator`, must be None or one of {0}"151 .format(allowed_values)152 )153 self._operator = operator154 def __repr__(self):155 return formatted_flat_dict(self)156 def __eq__(self, other):157 if other is None:158 return False159 return self.__dict__ == other.__dict__160 def __ne__(self, other):...
test_fixture.py
Source:test_fixture.py
...9 value = self.fixture(str)10 assert_that(value).is_not_empty()11 def test_fixture_should_create_integer(self):12 value = self.fixture(int)13 assert_that(value).is_greater_than_or_equal_to(0)14 def test_fixture_should_create_integer_range(self):15 value = self.fixture(int, fixture_range=(10, 20))16 assert_that(value).is_less_than_or_equal_to(20)17 assert_that(value).is_greater_than_or_equal_to(10)18 def test_fixture_should_create_email(self):19 value = self.fixture(Email)20 validate_email(value, check_deliverability=False)21 def test_fixture_should_create_floating_point_number(self):22 value = self.fixture(float)23 assert_that(value).is_greater_than_or_equal_to(0)24 assert_that(value).is_less_than_or_equal_to(1)25 def test_fixture_should_create_floating_point_number_range(self):26 value = self.fixture(float, fixture_range=(5, 10))27 assert_that(value).is_greater_than_or_equal_to(5)28 assert_that(value).is_less_than_or_equal_to(10)29 def test_fixture_should_create_datetime(self):30 value = self.fixture(datetime)31 assert_that(value).is_type_of(datetime)32 assert_that(value.tzinfo).is_equal_to(FixtureTest._utc())33 assert_that(value.year).is_greater_than_or_equal_to(1970)34 assert_that(value.year).is_less_than_or_equal_to(2100)35 def test_fixture_should_create_date(self):36 value = self.fixture(date)37 assert_that(value).is_type_of(date)38 assert_that(value.year).is_greater_than_or_equal_to(1970)39 assert_that(value.year).is_less_than_or_equal_to(2100)40 def test_fixture_return_one_of_values(self):41 value = self.fixture.one_of('one', 'two')42 assert_that(value).is_in('one', 'two')43 @classmethod44 def _utc(cls):45 try:46 from datetime import timezone47 except ImportError:48 import pytz as timezone...
test_is_greater_than_or_equal_to.py
Source:test_is_greater_than_or_equal_to.py
...21 ]22 for fr_param in field_params_rule_params:23 with self.subTest(fr_param=fr_param):24 self.assertTrue(25 self.FRC.is_greater_than_or_equal_to(26 LinkedProtoField(value=fr_param[0]),27 Rule(verb="is_greater_than_or_equal_to", params=fr_param[1]),28 )29 )30 def test_not_comply_greater(self):31 field_params_rule_params = [32 [2, 1],33 [0, -1],34 [1, 0],35 [1, -1],36 [-1, -2],37 [-1.3, -1.5],38 [0.9, -1.3],39 ]40 for fr_param in field_params_rule_params:41 with self.subTest(fr_param=fr_param):42 self.assertFalse(43 self.FRC.is_greater_than_or_equal_to(44 LinkedProtoField(value=fr_param[1]),45 Rule(verb="is_greater_than_or_equal_to", params=fr_param[0]),46 )47 )48 def test_comply_equal(self):49 field_params_rule_params = [[3, 3], [0, 0], [-1, -1], [-1.5, -1.5], [2.3, 2.3]]50 for fr_param in field_params_rule_params:51 with self.subTest(fr_param=fr_param):52 self.assertTrue(53 self.FRC.is_greater_than_or_equal_to(54 LinkedProtoField(value=fr_param[1]),55 Rule(verb="is_greater_than_or_equal_to", params=fr_param[0]),56 )...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!