How to use is_less_than_or_equal_to method in assertpy

Best Python code snippet using assertpy_python

filter.py

Source:filter.py Github

copy

Full Screen

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):...

Full Screen

Full Screen

utils.py

Source:utils.py Github

copy

Full Screen

1"""2@File: utils.py3@Author: Jared Galloway4This file will include some helpful functions5for the phippery package CLI. The primary6data struct we put counts data into is7So far it includes functions to"8* compile tsv files into a phip dataset9* TODO check phip_dataset attributed10"""11# dependencies12import pandas as pd13import numpy as np14import xarray as xr15import scipy.stats as st16# built-in python317import os18import copy19import itertools20from functools import reduce21def get_all_sample_metadata_factors(ds, feature):22 """23 return a list of all available factors in24 a sample table column25 """26 all_exp = ds.sample_table.loc[:, feature]27 return [x for x in set(all_exp.values) if x == x]28def get_all_peptide_metadata_factors(ds, feature):29 """30 return a list of all available factors in31 a peptide table column32 """33 all_exp = ds.peptide_table.loc[:, feature]34 return [x for x in set(all_exp.values) if x == x]35def iter_sample_groups(ds, groupby):36 """37 returns an iterator yeilding subsets of the provided dataset,38 grouped by an item on the sample metadata coodinate.39 """40 sample_table = ds.sample_table.to_pandas().reset_index()41 for group, group_st in sample_table.groupby(groupby):42 group_ds = ds.loc[dict(sample_id=list(group_st["sample_id"].values))]43 yield group, group_ds44def iter_peptide_groups(ds, groupby):45 """46 returns an iterator yeilding subsets of the provided dataset,47 grouped by an item on the peptide metadata coodinate.48 """49 peptide_table = ds.peptide_table.to_pandas()50 for group, group_st in peptide_table.groupby(groupby):51 group_ds = ds.loc[dict(peptide_id=list(group_st.index.values))]52 yield group, group_ds53# This could be generalized to do some helpful things with the enirchment tables54def id_coordinate_subset(55 ds,56 where,57 table="sample_table",58 is_equal_to=None,59 is_not_equal_to=None,60 is_greater_than=None,61 is_greater_than_or_equal_to=None,62 is_less_than=None,63 is_less_than_or_equal_to=None,64 is_in=None,65 is_valid=None,66):67 """68 a general function to compute the coordinate dimensions given some conditions.69 """70 if table not in ["sample_table", "peptide_table"]:71 raise ValueError(72 f"{table} is not a valid data table for {ds}\n Available data tables are: 'sample_table' or 'peptide_table'"73 )74 if table == "sample_table":75 metadata = "sample_metadata"76 metadata_features = ds[metadata]77 coord = "sample_id"78 else:79 metadata = "peptide_metadata"80 metadata_features = ds[metadata]81 coord = "peptide_id"82 if where not in metadata_features:83 raise ValueError(84 f"{where} is not in the sample metadata\n Available options are: {metadata_features.values}"85 )86 num_kw_args = [87 0 if arg is None else 188 for arg in [89 is_equal_to,90 is_not_equal_to,91 is_greater_than,92 is_greater_than_or_equal_to,93 is_less_than,94 is_less_than_or_equal_to,95 is_in,96 is_valid,97 ]98 ]99 if sum(num_kw_args) != 1:100 raise ValueError(101 "You must provide exactly one of the keyword conditional arguments"102 )103 table = ds[table]104 dim = table.loc[{metadata: where}]105 coordinate_ids = ds[coord]106 if is_equal_to is not None:107 return coordinate_ids[dim == is_equal_to].values108 elif is_not_equal_to is not None:109 return coordinate_ids[dim != is_not_equal_to].values110 elif is_greater_than is not None:111 return coordinate_ids[dim > is_greater_than].values112 elif is_greater_than_or_equal_to is not None:113 return coordinate_ids[dim >= is_greater_than_or_equal_to].values114 elif is_less_than is not None:115 return coordinate_ids[dim < is_less_than].values116 elif is_less_than_or_equal_to is not None:117 return coordinate_ids[dim <= is_less_than_or_equal_to].values118 elif is_in is not None:119 return coordinate_ids[dim.isin(is_in)].values120 else:121 return coordinate_ids[dim == dim].values122def sample_id_coordinate_subset(ds, where, **kwargs):123 return id_coordinate_subset(ds, where, "sample_table", **kwargs)124def peptide_id_coordinate_subset(ds, where, **kwargs):...

Full Screen

Full Screen

test_fixture.py

Source:test_fixture.py Github

copy

Full Screen

...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...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run assertpy automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful