How to use with_data method in Slash

Best Python code snippet using slash

test_data_import.py

Source:test_data_import.py Github

copy

Full Screen

...9 def test_export(self):10 exporter.get_template("User", all_doctypes="No", with_data="No")11 content = read_csv_content(frappe.response.result)12 self.assertTrue(content[1][1], "User")13 def test_export_with_data(self):14 exporter.get_template("User", all_doctypes="No", with_data="Yes")15 content = read_csv_content(frappe.response.result)16 self.assertTrue(content[1][1], "User")17 self.assertTrue("Administrator" in [c[1] for c in content if len(c)>1])18 def test_export_with_all_doctypes(self):19 exporter.get_template("User", all_doctypes="Yes", with_data="Yes")20 content = read_csv_content(frappe.response.result)21 self.assertTrue(content[1][1], "User")22 self.assertTrue('"Administrator"' in [c[1] for c in content if len(c)>1])23 self.assertEquals(content[13][0], "DocType:")24 self.assertEquals(content[13][1], "User")25 self.assertTrue("UserRole" in content[13])26 def test_import(self):27 if frappe.db.exists("Blog Category", "test-category"):...

Full Screen

Full Screen

config.py

Source:config.py Github

copy

Full Screen

1import yaml2import json3import os4def update(d, ud):5 for key, value in ud.items():6 overwrite = False7 if key.endswith('!'):8 key = key[:-1]9 overwrite = True10 if key not in d:11 d[key] = value12 elif isinstance(value, dict):13 if overwrite:14 d[key] = value15 else:16 update(d[key], value)17 elif isinstance(value, list) and isinstance(d[key], list):18 if overwrite:19 d[key] = value20 else:21 d[key] += value22 elif overwrite:23 d[key] = value24def load_include(value, include_path, with_data=True):25 path = os.path.abspath(os.path.join(os.path.dirname(include_path[-1]), value))26 if path in include_path:27 raise ValueError("Recursive import of {} (path: {})"\28 .format(path, '->'\29 .join(['"{}"'\30 .format(s) for s in include_path])))31 return load_config(path, include_path=include_path+[path], with_data=with_data)32def load_includes(config, include_path, with_data=True):33 if isinstance(config, dict):34 d = config.copy()35 for key, value in d.items():36 d[key] = load_includes(value, include_path=include_path, with_data=with_data)37 if '$include' in d:38 if not with_data and d.get("$data"):39 return d40 if d.get('$as-list'):41 nds = []42 is_list = True43 else:44 is_list = False45 nds = d.copy()46 del nds['$include']47 includes = d['$include']48 if not isinstance(includes, list):49 includes = [includes]50 for include in includes:51 nd = load_include(include, include_path, with_data=with_data)52 if nd is None:53 continue54 if is_list:55 if isinstance(nd, (list, tuple)):56 nds.extend(nd)57 else:58 nds.append(nd)59 else:60 if not isinstance(nd, dict):61 raise ValueError("expected a dictionary")62 update(nds, nd)63 return nds64 return d65 elif isinstance(config, (list, tuple)):66 l = []67 for c in config:68 result = load_includes(c, include_path=include_path, with_data=with_data)69 if isinstance(c, dict) and '$include' in c and isinstance(result, list):70 l.extend(result)71 else:72 l.append(result)73 return l74 return config75 76def load_config(filename, include_path=None, with_data=True):77 if include_path is None:78 include_path = [os.path.abspath(filename)]79 with open(filename) as input_file:80 if filename.endswith(".json"):81 # this is a JSON file82 config = json.load(input_file)83 else:84 config = yaml.load(input_file.read(),Loader=yaml.FullLoader)...

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