Best Python code snippet using lemoncheesecake
test_merging.py
Source:test_merging.py
1import pytest2from owlready2 import sync_reasoner_pellet3from utils.utils import DataTypeIssueException4def rgxcstr(core, column):5 def construction(regex_format):6 rc = core.RegexConstraint()7 rc.is_constraining_column = column8 rc.has_regex_format = regex_format9 return rc10 return construction11def test_not_unified_constraint_group_throws_exception(12 prepared_core, max_range_constraint_under_test, min_range_constraint_under_test):13 constraint_group = prepared_core.ConstraintGroup("TestGroup.Internal_01")14 constraint_group.has_constraints.append(max_range_constraint_under_test)15 constraint_group.has_constraints.append(min_range_constraint_under_test)16 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)17 constraint_group.is_a.append(prepared_core.RealizationDefinition)18 constraint_group.compliment_with_min_reqs()19 with pytest.raises(Exception, match=r"ERROR: Multiple constraints defined for column.*"):20 obj = constraint_group.fulfill_constraints_renew()21def test_not_unified_constraint_or_group_merges(22 prepared_core, list_constraint_under_test, min_range_constraint_under_test):23 # Not finished24 constraint_group = prepared_core.ConstraintGroup("TestGroup.Internal_02")25 constraint_group.has_constraints = list()26 constraint_group.has_constraints.append(list_constraint_under_test)27 constraint_group.has_constraints.append(min_range_constraint_under_test)28 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)29 constraint_group.is_a.append(prepared_core.RealizationDefinition)30 constraint_group.change_to_or_operator()31 #constraint_group.is_a.append(prepared_core.OrGroup)32 constraint_group.pick_branches_from_or_groups()33 constraint_group.compliment_with_min_reqs()34 obj = constraint_group.fulfill_constraints_renew()35 assert obj is not None36def test_min_range_merge_with_list(37 prepared_core, list_constraint_under_test, min_range_constraint_under_test, prepared_table):38 list_constraint_under_test.is_constraining_column = prepared_table.has_columns[0]39 constraint_group = prepared_core.ConstraintGroup()40 constraint_group.has_constraints.append(min_range_constraint_under_test)41 constraint_group.has_constraints.append(list_constraint_under_test)42 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)43 constraint_group.convert_to_realization_definition()44 realization_definition = constraint_group45 for number in range(100):46 generated_result = realization_definition.fulfill_constraints_renew()47 assert generated_result['column_01'] == '54'48def test_list_merge_with_range_max(49 prepared_core, list_constraint_under_test, max_range_constraint_under_test, prepared_table):50 list_constraint_under_test.is_constraining_column = prepared_table.has_columns[4]51 max_range_constraint_under_test.is_constraining_column = prepared_table.has_columns[4]52 constraint_group = prepared_core.ConstraintGroup()53 constraint_group.has_constraints.append(list_constraint_under_test)54 constraint_group.has_constraints.append(max_range_constraint_under_test)55 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)56 constraint_group.convert_to_realization_definition()57 realization_definition = constraint_group58 for number in range(100):59 generated_result = realization_definition.fulfill_constraints_renew()60 assert generated_result['column_05'] in ['1', '-3.14']61def test_list_merge_with_range_max_wrong_precision(62 prepared_core, list_constraint_under_test, max_range_constraint_under_test, prepared_table):63 list_constraint_under_test.is_constraining_column = prepared_table.has_columns[0]64 # max_range_constraint_under_test.is_constraining_column = prepared_table.has_columns[4]65 constraint_group = prepared_core.ConstraintGroup()66 constraint_group.has_constraints.append(list_constraint_under_test)67 constraint_group.has_constraints.append(max_range_constraint_under_test)68 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)69 constraint_group.convert_to_realization_definition()70 realization_definition = constraint_group71 for number in range(100):72 try:73 generated_result = realization_definition.fulfill_constraints_renew()74 assert generated_result['column_01'] in ['1']75 except DataTypeIssueException as ee:76 assert ee.args[0].startswith('ERROR: Boundary value -3.14 is not valid for data type')77def test_regex_merge_with_list(prepared_core, list_constraint_under_test, regex_constraint_under_test, prepared_table):78 list_constraint_under_test.is_constraining_column = prepared_table.has_columns[1]79 regex_constraint_under_test.is_constraining_column = prepared_table.has_columns[1]80 constraint_group = prepared_core.ConstraintGroup()81 constraint_group.has_constraints.append(list_constraint_under_test)82 constraint_group.has_constraints.append(regex_constraint_under_test)83 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)84 constraint_group.convert_to_realization_definition()85 realization_definition = constraint_group86 for number in range(100):87 generated_result = realization_definition.fulfill_constraints_renew()88 assert generated_result['column_02'] in ['moo', 'foo']89def test_list_merge_with_regex(prepared_core, list_constraint_under_test, regex_constraint_under_test, prepared_table):90 regex_constraint_under_test.is_constraining_column = prepared_table.has_columns[1]91 constraint_group = prepared_core.ConstraintGroup()92 constraint_group.has_constraints.append(regex_constraint_under_test)93 constraint_group.has_constraints.append(list_constraint_under_test)94 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)95 constraint_group.convert_to_realization_definition()96 realization_definition = constraint_group97 for number in range(100):98 generated_result = realization_definition.fulfill_constraints_renew()99 assert generated_result['column_02'] in ['moo', 'foo']100def test_regex_with_range(prepared_core, min_range_constraint_under_test, regex_constraint_under_test):101 constraint_group = prepared_core.ConstraintGroup()102 constraint_group.has_constraints.append(regex_constraint_under_test)103 constraint_group.has_constraints.append(min_range_constraint_under_test)104 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)105 with pytest.raises(Exception, match=r"ERROR: Not implemented"):106 constraint_group.unify_constraints()107def test_list_merged_with_not_in_list(prepared_core, prepared_column, list_constraint_under_test, prepared_table):108 list_constraint = prepared_core.ListConstraint()109 list_constraint.is_constraining_column = prepared_table.has_columns[1]110 list_constraint.has_picks = ['foo', 'moo', '1', 'baa', '54']111 constraint_group = prepared_core.ConstraintGroup()112 constraint_group.has_constraints.append(list_constraint_under_test)113 constraint_group.has_constraints.append(list_constraint.toggle_restriction())114 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)115 constraint_group.convert_to_realization_definition()116 realization_definition = constraint_group117 for number in range(100):118 generated_result = realization_definition.fulfill_constraints_renew()119 assert generated_result['column_02'] in ['-3.14', 'xD']120def test_not_in_list_merged_with_list(prepared_core, prepared_column, list_constraint_under_test, prepared_table):121 list_constraint = prepared_core.ListConstraint()122 list_constraint.is_constraining_column = prepared_table.has_columns[1]123 list_constraint.has_picks = ['foo', '-3.14', 'xD', 'baa', '54']124 constraint_group = prepared_core.ConstraintGroup()125 constraint_group.has_constraints.append(list_constraint_under_test)126 constraint_group.has_constraints.append(list_constraint.toggle_restriction())127 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)128 constraint_group.convert_to_realization_definition()129 realization_definition = constraint_group130 for number in range(100):131 generated_result = realization_definition.fulfill_constraints_renew()132 assert generated_result['column_02'] in ['moo', '1']133def test_list_merged_with_not_match(prepared_core, prepared_column, list_constraint_under_test, prepared_table):134 constraint_group = prepared_core.ConstraintGroup()135 constraint_group.has_constraints.append(list_constraint_under_test)136 rgx = rgxcstr(prepared_core, prepared_table.has_columns[1])137 constraint_group.has_constraints.append(rgx('.oo').toggle_restriction())138 constraint_group.has_constraints.append(rgx('.aa').toggle_restriction())139 constraint_group.has_constraints.append(rgx('-.*').toggle_restriction())140 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)141 constraint_group.convert_to_realization_definition()142 realization_definition = constraint_group143 for number in range(100):144 generated_result = realization_definition.fulfill_constraints_renew()145 assert generated_result['column_02'] in ['1', 'xD', '54']146def test_list_merged_with_multiple_not_matches(147 prepared_core, prepared_column, list_constraint_under_test, prepared_table):148 constraint_group = prepared_core.ConstraintGroup()149 constraint_group.has_constraints.append(list_constraint_under_test)150 rgx = rgxcstr(prepared_core, prepared_table.has_columns[1])151 constraint_group.has_constraints.append(rgx('^x.$').toggle_restriction())152 constraint_group.has_constraints.append(rgx('^.$').toggle_restriction())153 constraint_group.has_constraints.append(rgx('^..$').toggle_restriction())154 constraint_group.has_constraints.append(rgx('^-.*$').toggle_restriction())155 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)156 constraint_group.convert_to_realization_definition()157 realization_definition = constraint_group158 for number in range(100):159 generated_result = realization_definition.fulfill_constraints_renew()160 assert generated_result['column_02'] in ['foo', 'moo', 'baa']161def test_not_in_list_merged_with_regex(prepared_core, prepared_column, regex_constraint_under_test):162 prepared_column.has_data_type = prepared_core.Varchar()163 list_constraint = prepared_core.ListConstraint()164 list_constraint.is_constraining_column = prepared_column165 list_constraint.has_picks = \166 ["aoo", "boo", "coo", "doo", "eoo", "foo", "goo", "hoo", "ioo", "joo", "koo", "loo", "moo", "noo"]167 constraint_group = prepared_core.ConstraintGroup()168 constraint_group.has_constraints.append(regex_constraint_under_test)169 constraint_group.has_constraints.append(list_constraint.toggle_restriction())170 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)171 constraint_group.convert_to_realization_definition()172 realization_definition = constraint_group173 for number in range(100):174 generated_result = realization_definition.fulfill_constraints_renew()175 assert generated_result['column_01'] in \176 ["ooo", "poo", "qoo", "roo", "soo", "too", "uoo", "voo", "woo", "xoo", "yoo", "zoo"]177def test_regex_merged_with_multiple_not_matches(prepared_core, prepared_column, regex_constraint_under_test):178 prepared_column.has_data_type = prepared_core.Varchar()179 constraint_group = prepared_core.ConstraintGroup()180 constraint_group.has_constraints.append(regex_constraint_under_test)181 rgx = rgxcstr(prepared_core, prepared_column)182 constraint_group.has_constraints.append(rgx('^[t-z]oo$').toggle_restriction())183 constraint_group.has_constraints.append(rgx('^[a-f]oo$').toggle_restriction())184 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)185 constraint_group.convert_to_realization_definition()186 realization_definition = constraint_group187 for number in range(100):188 generated_result = realization_definition.fulfill_constraints_renew()189 assert generated_result['column_01'] in \190 ["goo", "hoo", "ioo", "joo", "koo", "loo", "moo", "noo", "ooo", "poo", "qoo", "roo", "soo"]191def test_range_merged_with_not_in_list(prepared_core, prepared_column):192 limited_data_type = prepared_core.Decimal()193 limited_data_type.has_precision = 3194 limited_data_type.has_scale = 0195 prepared_column.has_data_type = limited_data_type196 range_const = prepared_core.RangeConstraint("jhlkndsd")197 range_const.is_constraining_column = prepared_column198 range_const.set_left_boundary(40)199 range_const.set_right_boundary(60)200 list_constraint = prepared_core.ListConstraint()201 list_constraint.is_constraining_column = prepared_column202 list_constraint.has_picks = \203 ["40", "41", "42", "43", "44", "45", "46", "47", "58", "59", "60"]204 constraint_group = prepared_core.ConstraintGroup()205 constraint_group.has_constraints.append(range_const)206 constraint_group.has_constraints.append(list_constraint.toggle_restriction())207 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)208 constraint_group.convert_to_realization_definition()209 realization_definition = constraint_group210 for number in range(100):211 generated_result = realization_definition.fulfill_constraints_renew()212 print(generated_result['column_01'])213 assert generated_result['column_01'][:2] in \214 ["48", "49", "50", "51", "52", "53", "54", "55", "56", "57"]215def test_range_merged_with_not_match(prepared_core, prepared_column):216 range_const = prepared_core.RangeConstraint("jhlkndsd")217 range_const.is_constraining_column = prepared_column218 range_const.set_left_boundary(40)219 range_const.set_right_boundary(60)220 regex_constraint = prepared_core.RegexConstraint()221 regex_constraint.is_constraining_column = prepared_column222 regex_constraint.has_regex_format = '^4.*'223 constraint_group = prepared_core.ConstraintGroup()224 constraint_group.has_constraints.append(range_const)225 constraint_group.has_constraints.append(regex_constraint.toggle_restriction())226 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)227 constraint_group.convert_to_realization_definition()228 realization_definition = constraint_group229 for number in range(100):230 generated_result = realization_definition.fulfill_constraints_renew()231 assert generated_result['column_01'][:2] in \232 ["50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60"]233def test_range_merged_with_multiple_not_matches(prepared_core, prepared_column):234 range_const = prepared_core.RangeConstraint("jhlkndsd")235 range_const.is_constraining_column = prepared_column236 range_const.set_left_boundary(40)237 range_const.set_right_boundary(60)238 constraint_group = prepared_core.ConstraintGroup()239 constraint_group.has_constraints.append(range_const)240 rgx = rgxcstr(prepared_core, prepared_column)241 constraint_group.has_restricting_constraints = [rgx('^4.*'), rgx('^.[5-9].*$')]242 constraint_group.has_constraints.append(rgx('^4.*').toggle_restriction())243 constraint_group.has_constraints.append(rgx('^.[5-9].*$').toggle_restriction())244 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)245 constraint_group.convert_to_realization_definition()246 realization_definition = constraint_group247 for number in range(100):248 generated_result = realization_definition.fulfill_constraints_renew()249 assert generated_result['column_01'][:2] in \250 ["50", "51", "52", "53", "54", "60"]251def test_constraint_and_dependency_for_same_column(252 prepared_core, prepared_column, list_constraint_under_test, prepared_table):253 list_constraint_under_test.is_constraining_column = prepared_table.has_columns[0]254 # raise exception cannot have constraint and dependency for same column255 dependency_const = prepared_core.ValueDependency("badfgqasx")256 dependency_const.is_constraining_column = prepared_column257 dependency_const.has_format_definition = "copy_{column_1}"258 constraint_group = prepared_core.ConstraintGroup()259 constraint_group.has_constraints.append(dependency_const)260 constraint_group.has_constraints.append(list_constraint_under_test)261 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)262 with pytest.raises(Exception, match=r"^ERROR: Cannot merge Value Dependency.*"):263 constraint_group.unify_constraints()264def test_unification_of_constraint_works_with_dependencies(prepared_core, prepared_column, list_constraint_under_test):265 column_2 = next(col for col in prepared_column.is_part_of_table.has_columns if "column_02" in col.name)266 list_constraint_under_test.is_constraining_column = column_2267 range_const = prepared_core.RangeConstraint("jhlkndsd")268 range_const.is_constraining_column = prepared_column269 range_const.set_left_boundary(40)270 range_const.set_right_boundary(60)271 constraint_group = prepared_core.ConstraintGroup()272 constraint_group.has_constraints.append(range_const)273 constraint_group.has_constraints.append(list_constraint_under_test)274 rgx = rgxcstr(prepared_core, prepared_column)275 constraint_group.has_constraints.append(rgx('^4.*$').toggle_restriction())276 constraint_group.has_constraints.append(rgx('^.[5-9].*$').toggle_restriction())277 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)278 constraint_group.convert_to_realization_definition()279 realization_definition = constraint_group280 for number in range(100):281 generated_result = realization_definition.fulfill_constraints_renew()282 assert generated_result['column_01'][:2] in \283 ["50", "51", "52", "53", "54", "60"]284 assert generated_result['column_02'] in \285 ['foo', 'moo', '1', 'baa', '-3.14', 'xD', '54']286def test_two_dependencies(prepared_core, prepared_column):287 dependency_const = prepared_core.ValueDependency("badfgqasx")288 dependency_const.is_constraining_column = prepared_column289 dependency_const.has_format_definition = "copy_{column_02}"290 dependency_const_2 = prepared_core.ValueDependency("aksdjfhw49eydh")291 dependency_const_2.is_constraining_column = prepared_column292 dependency_const_2.has_format_definition = "copy_{column_02}"293 constraint_group = prepared_core.ConstraintGroup()294 constraint_group.has_constraints.append(dependency_const)295 constraint_group.has_constraints.append(dependency_const_2)296 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)297 with pytest.raises(Exception, match=r"^ERROR: Cannot merge Value Dependency.*"):298 constraint_group.unify_constraints()299def test_constraints_for_multiple_tables_in_constraints_group_bad_convertion_to_single_reazlization_definition(300 prepared_core, prepared_table, prepared_table_2, list_constraint_under_test):301 list_constraint_under_test.is_constraining_column = prepared_table_2.has_columns[0]302 range_const = prepared_core.RangeConstraint("jhlkndsd")303 range_const.is_constraining_column = prepared_table.has_columns[0]304 range_const.set_left_boundary(40)305 range_const.set_right_boundary(60)306 constraint_group = prepared_core.ConstraintGroup()307 constraint_group.has_constraints.append(range_const)308 constraint_group.has_constraints.append(list_constraint_under_test)309 rgx = rgxcstr(prepared_core, prepared_table.has_columns[0])310 constraint_group.has_constraints.append(rgx('^4.*$').toggle_restriction())311 constraint_group.has_constraints.append(rgx('^.[5-9].*$').toggle_restriction())312 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)313 with pytest.raises(Exception, match=r"^ERROR: .*constraints more then one table. Should only one."):314 constraint_group.convert_to_realization_definition()315def test_constraints_for_multiple_tables_in_constraints_group_turns_into_realization_case(316 prepared_core, prepared_table, prepared_table_2, list_constraint_under_test):317 """ or multiple_realization_definitions_"""318 list_constraint_under_test.is_constraining_column = prepared_table_2.has_columns[0]319 limited_data_type = prepared_core.Decimal()320 limited_data_type.has_precision = 3321 limited_data_type.has_scale = 0322 prepared_table.has_columns[0].has_data_type = limited_data_type323 range_const = prepared_core.RangeConstraint("lkjasdnfkadfj")324 range_const.is_constraining_column = prepared_table.has_columns[0]325 # range_const.has_min_range = 40326 # range_const.has_max_range = 60327 range_const.set_left_boundary(40)328 range_const.set_right_boundary(60)329 constraint_group = prepared_core.ConstraintGroup()330 constraint_group.has_constraints.append(range_const)331 constraint_group.has_constraints.append(list_constraint_under_test)332 rgx = rgxcstr(prepared_core, prepared_table.has_columns[0])333 constraint_group.has_constraints.append(rgx('^4.*$').toggle_restriction())334 constraint_group.has_constraints.append(rgx('^.[5-9].*$').toggle_restriction())335 sync_reasoner_pellet(infer_property_values=True, infer_data_property_values=False)336 case = constraint_group.build_realization_case()337 generated_result = case.realize()338 # expected result example339 # generated_result = {340 # 'internal_test_table_01': [{'column_01': '60', 'column_02': None}],341 # 'internal_test_table_02': [{'column_02': '-3.14'}]342 # }343 assert len(generated_result.keys()) == 2, "Generated results should be for two different tables."344 assert generated_result['internal_test_table_01'][0]['column_01'][:2] in \345 ["50", "51", "52", "53", "54", "60"]346 assert generated_result['internal_test_table_01'][0]['column_02'] is None347 assert "column_01" in generated_result['internal_test_table_02'][0]348 assert generated_result['internal_test_table_02'][0]['column_01'] in ['foo', 'moo', '1', 'baa', '-3.14', 'xD', '54']349def test_constraints_for_same_table_but_different_realization_definitions_do_not_merge():...
test_validation.py
Source:test_validation.py
...82 PandasColumn.string_column('bar'),83 ],84 dataframe_constraints=[RowCountConstraint(2)],85 )86def has_constraints(column, constraints):87 for constraint in constraints:88 if not any(89 [isinstance(col_constraint, constraint) for col_constraint in column.constraints]90 ):91 return False92 return True93@pytest.mark.parametrize(94 'composer, composer_args, expected_constraints',95 [96 (PandasColumn.boolean_column, [], [ColumnDTypeFnConstraint]),97 (PandasColumn.numeric_column, [], [ColumnDTypeFnConstraint, InRangeColumnConstraint]),98 (PandasColumn.datetime_column, [], [ColumnDTypeInSetConstraint, InRangeColumnConstraint]),99 (PandasColumn.string_column, [], [ColumnDTypeFnConstraint]),100 (101 PandasColumn.categorical_column,102 [{'a', 'b'}],103 [ColumnDTypeInSetConstraint, CategoricalColumnConstraint],104 ),105 ],106)107def test_datetime_column_composition(composer, composer_args, expected_constraints):108 column = composer('foo', *composer_args)109 assert isinstance(column, PandasColumn)110 assert column.name == 'foo'111 assert has_constraints(column, expected_constraints)112 # Test non nullable constraint flag113 non_nullable_included_constraints = expected_constraints + [NonNullableColumnConstraint]114 non_nullable_column = composer('foo', *composer_args, non_nullable=True)115 assert has_constraints(non_nullable_column, non_nullable_included_constraints)116 # Test unique constraint flag117 distinct_included_constraints = expected_constraints + [UniqueColumnConstraint]118 distinct_column = composer('foo', *composer_args, unique=True)119 assert has_constraints(distinct_column, distinct_included_constraints)120 # Test ignore_missing_values flag121 ignore_column = composer('foo', *composer_args, ignore_missing_vals=True)122 assert has_constraints(ignore_column, expected_constraints)123 for constraint in ignore_column.constraints:124 if hasattr(constraint, 'ignore_missing_vals'):...
check_syntax.py
Source:check_syntax.py
1"""Syntax checks2These checks verify syntax (schema), in particular for the ``extra``3section that is otherwise free-form.4"""5import re6from . import LintCheck, ERROR, WARNING, INFO7class version_constraints_missing_whitespace(LintCheck):8 """Packages and their version constraints must be space separated9 Example::10 host:11 python >=312 """13 def check_recipe(self, recipe):14 check_paths = []15 for section in ('build', 'run', 'host'):16 check_paths.append(f'requirements/{section}')17 constraints = re.compile("(.*?)([<=>].*)")18 for path in check_paths:19 for n, spec in enumerate(recipe.get(path, [])):20 has_constraints = constraints.search(spec)21 if has_constraints:22 space_separated = has_constraints[1].endswith(" ")23 if not space_separated:24 self.message(section=f"{path}/{n}", data=True)25 def fix(self, _message, _data):26 check_paths = []27 for section in ('build', 'run', 'host'):28 check_paths.append(f'requirements/{section}')29 constraints = re.compile("(.*?)([<=>].*)")30 for path in check_paths:31 for spec in self.recipe.get(path, []):32 has_constraints = constraints.search(spec)33 if has_constraints:34 space_separated = has_constraints[1].endswith(" ")35 if not space_separated:36 dep, ver = has_constraints.groups()37 self.recipe.replace(spec, f"{dep} {ver}", within='requirements')38 return True39class extra_identifiers_not_list(LintCheck):40 """The extra/identifiers section must be a list41 Example::42 extra:43 identifiers:44 - doi:12345 """46 def check_recipe(self, recipe):47 identifiers = recipe.get('extra/identifiers', None)48 if identifiers and not isinstance(identifiers, list):49 self.message(section='extra/identifiers')50class extra_identifiers_not_string(LintCheck):51 """Each item in the extra/identifiers section must be a string52 Example::53 extra:54 identifiers:55 - doi:12356 Note that there is no space around the colon57 """58 requires = [extra_identifiers_not_list]59 def check_recipe(self, recipe):60 identifiers = recipe.get('extra/identifiers', [])61 for n, identifier in enumerate(identifiers):62 if not isinstance(identifier, str):63 self.message(section=f'extra/identifiers/{n}')64class extra_identifiers_missing_colon(LintCheck):65 """Each item in the extra/identifiers section must be of form ``type:value``66 Example::67 extra:68 identifiers:69 - doi:12370 """71 requires = [extra_identifiers_not_string]72 def check_recipe(self, recipe):73 identifiers = recipe.get('extra/identifiers', [])74 for n, identifier in enumerate(identifiers):75 if ':' not in identifier:76 self.message(section=f'extra/identifiers/{n}')77class extra_skip_lints_not_list(LintCheck):78 """The extra/skip-lints section must contain a list79 Example::80 extra:81 skip-lints:82 - should_use_compilers83 """84 def check_recipe(self, recipe):85 if not isinstance(recipe.get('extra/skip-lints', []), list):...
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!!