Best Python code snippet using toolium_python
fixtures.py
Source:fixtures.py
1# ----------------------------------------------------------------------------2# A dictionary of dicts, with only the minimum required is_selected attribute,3# for use with examples using a simple list of integers in a list view.4integers_dict = \5 { str(i): {'text': str(i), 'is_selected': False} for i in xrange(100)}6# ----------------------------------------------------------------------------7# A dataset of fruit category and fruit data for use in examples.8#9# Data from http://www.fda.gov/Food/LabelingNutrition/\10# FoodLabelingGuidanceRegulatoryInformation/\11# InformationforRestaurantsRetailEstablishments/\12# ucm063482.htm13#14# Available items for import are:15#16# fruit_categories17# fruit_data_attributes18# fruit_data_attribute_units19# fruit_data_list_of_dicts20# fruit_data21#22fruit_categories = \23 {'Melons': {'name': 'Melons',24 'fruits': ['Cantaloupe', 'Honeydew', 'Watermelon'],25 'is_selected': False},26 'Tree Fruits': {'name': 'Tree Fruits',27 'fruits': ['Apple', 'Avocado', 'Banana', 'Nectarine',28 'Peach', 'Pear', 'Pineapple', 'Plum',29 'Cherry'],30 'is_selected': False},31 'Citrus Fruits': {'name': 'Citrus Fruits',32 'fruits': ['Grapefruit', 'Lemon', 'Lime', 'Orange',33 'Tangerine'],34 'is_selected': False},35 'Other Fruits': {'name': 'Other Fruits',36 'fruits': ['Grape', 'Kiwifruit',37 'Strawberry'],38 'is_selected': False}}39fruit_data_list_of_dicts = [40{'name':'Apple',41 'Serving Size': '1 large (242 g/8 oz)',42 'data': [130, 0, 0, 0, 0, 0, 260, 7, 34, 11, 5, 20, 25, 1, 2, 8, 2, 2],43 'is_selected': False},44{'name':'Avocado',45 'Serving Size': '1/5 medium (30 g/1.1 oz)',46 'data': [50, 35, 4.5, 7, 0, 0, 140, 4, 3, 1, 1, 4, 0, 1, 0, 4, 0, 2],47 'is_selected': False},48{'name':'Banana',49 'Serving Size': '1 medium (126 g/4.5 oz)',50 'data': [110, 0, 0, 0, 0, 0, 450, 13, 30, 10, 3, 12, 19, 1, 2, 15, 0, 2],51 'is_selected': False},52{'name':'Cantaloupe',53 'Serving Size': '1/4 medium (134 g/4.8 oz)',54 'data': [50, 0, 0, 0, 20, 1, 240, 7, 12, 4, 1, 4, 11, 1, 120, 80, 2, 2],55 'is_selected': False},56{'name':'Grapefruit',57 'Serving Size': '1/2 medium (154 g/5.5 oz)',58 'data': [60, 0, 0, 0, 0, 0, 160, 5, 15, 5, 2, 8, 11, 1, 35, 100, 4, 0],59 'is_selected': False},60{'name':'Grape',61 'Serving Size': '3/4 cup (126 g/4.5 oz)',62 'data': [90, 0, 0, 0, 15, 1, 240, 7, 23, 8, 1, 4, 20, 0, 0, 2, 2, 0],63 'is_selected': False},64{'name':'Honeydew',65 'Serving Size': '1/10 medium melon (134 g/4.8 oz)',66 'data': [50, 0, 0, 0, 30, 1, 210, 6, 12, 4, 1, 4, 11, 1, 2, 45, 2, 2],67 'is_selected': False},68{'name':'Kiwifruit',69 'Serving Size': '2 medium (148 g/5.3 oz)',70 'data': [90, 10, 1, 2, 0, 0, 450, 13, 20, 7, 4, 16, 13, 1, 2, 240, 4, 2],71 'is_selected': False},72{'name':'Lemon',73 'Serving Size': '1 medium (58 g/2.1 oz)',74 'data': [15, 0, 0, 0, 0, 0, 75, 2, 5, 2, 2, 8, 2, 0, 0, 40, 2, 0],75 'is_selected': False},76{'name':'Lime',77 'Serving Size': '1 medium (67 g/2.4 oz)',78 'data': [20, 0, 0, 0, 0, 0, 75, 2, 7, 2, 2, 8, 0, 0, 0, 35, 0, 0],79 'is_selected': False},80{'name':'Nectarine',81 'Serving Size': '1 medium (140 g/5.0 oz)',82 'data': [60, 5, 0.5, 1, 0, 0, 250, 7, 15, 5, 2, 8, 11, 1, 8, 15, 0, 2],83 'is_selected': False},84{'name':'Orange',85 'Serving Size': '1 medium (154 g/5.5 oz)',86 'data': [80, 0, 0, 0, 0, 0, 250, 7, 19, 6, 3, 12, 14, 1, 2, 130, 6, 0],87 'is_selected': False},88{'name':'Peach',89 'Serving Size': '1 medium (147 g/5.3 oz)',90 'data': [60, 0, 0.5, 1, 0, 0, 230, 7, 15, 5, 2, 8, 13, 1, 6, 15, 0, 2],91 'is_selected': False},92{'name':'Pear',93 'Serving Size': '1 medium (166 g/5.9 oz)',94 'data': [100, 0, 0, 0, 0, 0, 190, 5, 26, 9, 6, 24, 16, 1, 0, 10, 2, 0],95 'is_selected': False},96{'name':'Pineapple',97 'Serving Size': '2 slices, 3" diameter, 3/4" thick (112 g/4 oz)',98 'data': [50, 0, 0, 0, 10, 0, 120, 3, 13, 4, 1, 4, 10, 1, 2, 50, 2, 2],99 'is_selected': False},100{'name':'Plum',101 'Serving Size': '2 medium (151 g/5.4 oz)',102 'data': [70, 0, 0, 0, 0, 0, 230, 7, 19, 6, 2, 8, 16, 1, 8, 10, 0, 2],103 'is_selected': False},104{'name':'Strawberry',105 'Serving Size': '8 medium (147 g/5.3 oz)',106 'data': [50, 0, 0, 0, 0, 0, 170, 5, 11, 4, 2, 8, 8, 1, 0, 160, 2, 2],107 'is_selected': False},108{'name':'Cherry',109 'Serving Size': '21 cherries; 1 cup (140 g/5.0 oz)',110 'data': [100, 0, 0, 0, 0, 0, 350, 10, 26, 9, 1, 4, 16, 1, 2, 15, 2, 2],111 'is_selected': False},112{'name':'Tangerine',113 'Serving Size': '1 medium (109 g/3.9 oz)',114 'data': [50, 0, 0, 0, 0, 0, 160, 5, 13, 4, 2, 8, 9, 1, 6, 45, 4, 0],115 'is_selected': False},116{'name':'Watermelon',117 'Serving Size': '1/18 medium melon; 2 cups diced pieces (280 g/10.0 oz)',118 'data': [80, 0, 0, 0, 0, 0, 270, 8, 21, 7, 1, 4, 20, 1, 30, 25, 2, 4],119 'is_selected': False}]120fruit_data_attributes = ['(gram weight/ ounce weight)',121 'Calories',122 'Calories from Fat',123 'Total Fat',124 'Sodium',125 'Potassium',126 'Total Carbo-hydrate',127 'Dietary Fiber',128 'Sugars',129 'Protein',130 'Vitamin A',131 'Vitamin C',132 'Calcium',133 'Iron']134fruit_data_attribute_units = ['(g)',135 '(%DV)',136 '(mg)',137 '(%DV)',138 '(mg)',139 '(%DV)',140 '(g)',141 '(%DV)',142 '(g)(%DV)',143 '(g)',144 '(g)',145 '(%DV)',146 '(%DV)',147 '(%DV)',148 '(%DV)']149attributes_and_units = dict(zip(fruit_data_attributes, fruit_data_attribute_units))150fruit_data = {}151for fruit_record in fruit_data_list_of_dicts:152 fruit_data[fruit_record['name']] = {}153 fruit_data[fruit_record['name']] = \154 dict({'name': fruit_record['name'],155 'Serving Size': fruit_record['Serving Size'],156 'is_selected': fruit_record['is_selected']},...
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!!