How to use mark_value method in Slash

Best Python code snippet using slash

qgis_vector_tools.py

Source:qgis_vector_tools.py Github

copy

Full Screen

1# coding=utf-82"""**Utilities around QgsVectorLayer**3"""4__author__ = 'Dmitry Kolesov <kolesov.dm@gmail.com>'5__revision__ = '8e90270d76bc3e85f0084bd480f8e977a33cb812'6__date__ = '14/01/2014'7__license__ = "GPL"8__copyright__ = 'Copyright 2012, Australia Indonesia Facility for '9__copyright__ += 'Disaster Reduction'10import itertools11from safe.common.utilities import unique_filename12from safe.storage.raster import qgis_imported13from safe.common.exceptions import WrongDataTypeException14if qgis_imported: # Import QgsRasterLayer if qgis is available15 from PyQt4.QtCore import QVariant16 from qgis.core import (17 QgsField,18 QgsVectorLayer,19 QgsFeature,20 QgsPoint,21 QgsGeometry,22 QgsFeatureRequest,23 QgsVectorFileWriter24 )25def points_to_rectangles(points, dx, dy):26 """Create polygon layer around points. The polygons are dx to dy.27 Attributes of the points are copied.28 A point position is upper-left corner of the created rectangle.29 :param points: Point layer.30 :type points: QgsVectorLayer31 :param dx: Length of the horizontal sides32 :type dx: float33 :param dy: Length of the vertical sides34 :type dy: float35 :returns: Polygon layer36 :rtype: QgsVectorLayer37 """38 crs = points.crs().toWkt()39 point_provider = points.dataProvider()40 fields = point_provider.fields()41 # Create layer for store the lines from E and extent42 polygons = QgsVectorLayer(43 'Polygon?crs=' + crs, 'polygons', 'memory')44 polygon_provider = polygons.dataProvider()45 polygon_provider.addAttributes(fields.toList())46 polygons.startEditing()47 for feature in points.getFeatures():48 attrs = feature.attributes()49 point = feature.geometry().asPoint()50 x, y = point.x(), point.y()51 # noinspection PyCallByClass,PyTypeChecker52 g = QgsGeometry.fromPolygon([53 [QgsPoint(x, y),54 QgsPoint(x + dx, y),55 QgsPoint(x + dx, y - dy),56 QgsPoint(x, y - dy)]57 ])58 polygon_feat = QgsFeature()59 polygon_feat.setGeometry(g)60 polygon_feat.setAttributes(attrs)61 _ = polygon_provider.addFeatures([polygon_feat])62 polygons.commitChanges()63 return polygons64def union_geometry(vector, request=QgsFeatureRequest()):65 """Return union of the vector geometries regardless of the attributes.66 (If request is specified, filter the objects before union).67 If all geometries in the vector are invalid, return None.68 The boundaries will be dissolved during the operation.69 :param vector: Vector layer70 :type vector: QgsVectorLayer71 :param request: Filter for vector objects72 :type request: QgsFeatureRequest73 :return: Union of the geometry74 :rtype: QgsGeometry or None75 """76 result_geometry = None77 for feature in vector.getFeatures(request):78 if result_geometry is None:79 result_geometry = QgsGeometry(feature.geometry())80 else:81 # But some feature.geometry() may be invalid, skip them82 tmp_geometry = result_geometry.combine(feature.geometry())83 try:84 if tmp_geometry.isGeosValid():85 result_geometry = tmp_geometry86 except AttributeError:87 pass88 return result_geometry89def create_layer(vector):90 """Create empty layer.91 The CRS and Geometry Type of new layer are the same as of vector layer.92 Attributes of the layer are copied from vector.93 :param vector: Vector layer94 :type vector: QgsVectorLayer95 :returns: Empty vector layer (stored in memory)96 :rtype: QgsVectorLayer97 """98 crs = vector.crs().toWkt()99 if vector.geometryType() == 0:100 msg = "Points cant' be split"101 raise WrongDataTypeException(msg)102 elif vector.geometryType() == 1:103 uri = 'LineString?crs=' + crs104 elif vector.geometryType() == 2:105 uri = 'Polygon?crs=' + crs106 else:107 msg = "Received unexpected type of layer geometry: %s" \108 % (vector.geometryType(),)109 raise WrongDataTypeException(msg)110 result_layer = QgsVectorLayer(uri, 'intersected', 'memory')111 result_provider = result_layer.dataProvider()112 result_layer.startEditing()113 # Copy fields from vector114 vector_provider = vector.dataProvider()115 fields = vector_provider.fields()116 result_provider.addAttributes(fields.toList())117 result_layer.commitChanges()118 return result_layer119def clip_by_polygon(120 vector,121 polygon):122 """Clip vector layer using polygon.123 Return part of the objects that lie within the polygon.124 :param vector: Vector layer125 :type vector: QgsVectorLayer126 :param polygon: Clipping polygon127 :type polygon: QgsGeometry128 :returns: Vector layer with split geometry129 :rtype: QgsVectorLayer130 """131 result_layer = create_layer(vector)132 result_layer.startEditing()133 for feature in vector.getFeatures():134 geom = feature.geometry()135 attributes = feature.attributes()136 geometry_type = geom.type()137 if polygon.intersects(geom):138 # Find parts of initial_geom, intersecting139 # with the polygon, then mark them if needed140 intersection = QgsGeometry(141 geom.intersection(polygon)142 ).asGeometryCollection()143 for g in intersection:144 if g.type() == geometry_type:145 feature = QgsFeature()146 feature.setGeometry(g)147 feature.setAttributes(attributes)148 _ = result_layer.dataProvider().addFeatures([feature])149 result_layer.commitChanges()150 result_layer.updateExtents()151 return result_layer152def split_by_polygon(153 vector,154 polygon,155 request=QgsFeatureRequest(),156 mark_value=None):157 """Split objects from vector layer by polygon.158 If request is specified, filter the objects before splitting.159 If part of vector object lies in the polygon, mark it by mark_value (160 optional).161 :param vector: Vector layer162 :type vector: QgsVectorLayer163 :param polygon: Splitting polygon164 :type polygon: QgsGeometry165 :param request: Filter for vector objects166 :type request: QgsFeatureRequest167 :param mark_value: Field value to mark the objects.168 :type mark_value: (field_name, field_value).or None169 :returns: Vector layer with split geometry170 :rtype: QgsVectorLayer171 """172 def _set_feature(geometry, feature_attributes):173 """174 Helper to create and set up feature175 """176 included_feature = QgsFeature()177 included_feature.setGeometry(geometry)178 included_feature.setAttributes(feature_attributes)179 return included_feature180 def _update_attr_list(attributes, index, value, add_attribute=False):181 """182 Helper for update list of attributes.183 """184 new_attributes = attributes[:]185 if add_attribute:186 new_attributes.append(value)187 else:188 new_attributes[index] = value189 return new_attributes190 # Create layer to store the splitted objects191 result_layer = create_layer(vector)192 result_provider = result_layer.dataProvider()193 fields = result_provider.fields()194 # If target_field does not exist, add it:195 new_field_added = False196 if mark_value is not None:197 target_field = mark_value[0]198 if fields.indexFromName(target_field) == -1:199 result_layer.startEditing()200 result_provider.addAttributes(201 [QgsField(target_field, QVariant.Int)])202 new_field_added = True203 result_layer.commitChanges()204 target_value = None205 if mark_value is not None:206 target_field = mark_value[0]207 target_value = mark_value[1]208 target_field_index = result_provider.fieldNameIndex(target_field)209 if target_field_index == -1:210 raise WrongDataTypeException(211 'Field not found for %s' % target_field)212 # Start split procedure213 result_layer.startEditing()214 for initial_feature in vector.getFeatures(request):215 initial_geom = initial_feature.geometry()216 attributes = initial_feature.attributes()217 geometry_type = initial_geom.type()218 if polygon.intersects(initial_geom):219 # Find parts of initial_geom, intersecting220 # with the polygon, then mark them if needed221 intersection = QgsGeometry(222 initial_geom.intersection(polygon)223 ).asGeometryCollection()224 for g in intersection:225 if g.type() == geometry_type:226 if mark_value is not None:227 new_attributes = _update_attr_list(228 attributes,229 target_field_index,230 target_value,231 add_attribute=new_field_added232 )233 else:234 new_attributes = attributes235 feature = _set_feature(g, new_attributes)236 _ = result_layer.dataProvider().addFeatures([feature])237 # Find parts of the initial_geom that do not lie in the polygon238 diff_geom = QgsGeometry(239 initial_geom.symDifference(polygon)240 ).asGeometryCollection()241 for g in diff_geom:242 if g.type() == geometry_type:243 if mark_value is not None:244 new_attributes = _update_attr_list(245 attributes,246 target_field_index,247 0,248 add_attribute=new_field_added249 )250 else:251 new_attributes = attributes252 feature = _set_feature(g, new_attributes)253 _ = result_layer.dataProvider().addFeatures([feature])254 else:255 if mark_value is not None:256 new_attributes = _update_attr_list(257 attributes,258 target_field_index,259 0,260 add_attribute=new_field_added261 )262 else:263 new_attributes = attributes264 feature = _set_feature(initial_geom, new_attributes)265 _ = result_layer.dataProvider().addFeatures([feature])266 result_layer.commitChanges()267 result_layer.updateExtents()268 return result_layer269def split_by_polygon_in_out(270 vector,271 polygon_in,272 polygon_out,273 target_field,274 value,275 request=QgsFeatureRequest()):276 """Split a polygon layer updating the target field with the value.277 All parts of vector layer will have their target_field updated to278 value if they fall within polygon_in.279 :param vector: A polygon vector layer to split.280 :type vector: QgsVectorLayer281 :param polygon_in: Polygon within which vector features will be considered282 to be contained.283 :type polygon_in: QgsGeometry284 :param polygon_out: Polygon within which vector features will be considered285 to be NOT contained.286 :type polygon_out: QgsGeometry287 :param target_field: Field in vector layer to be updated if features288 are within polygon_in.289 :type target_field: QgsField290 :param value: Value to update the target field with if polygons are in.291 :type value: int, float, str292 :param request: Optional feature request used to subset the features293 in vector.294 :type request: QgsFeatureRequest295 :return: QgsVectorLayer of split line for whichever is greater,296 in our out polygons.297 :rtype: QgsVectorLayer298 """299 base_name = unique_filename()300 file_name_in = base_name + '_in.shp'301 file_name_out = base_name + '_out.shp'302 file_name_poly_in = base_name + '_poly_in.shp'303 file_name_poly_out = base_name + '_poly_out.shp'304 # noinspection PyArgumentEqualDefault305 line_layer_in = split_by_polygon2(306 vector,307 polygon_in,308 request,309 use_contains_operation=False,310 mark_value=(target_field, value))311 line_layer_out = split_by_polygon2(312 vector,313 polygon_out,314 request,315 use_contains_operation=True,316 mark_value=(target_field, 0))317 QgsVectorFileWriter.writeAsVectorFormat(318 line_layer_in, file_name_in, "utf-8", None, "ESRI Shapefile")319 QgsVectorFileWriter.writeAsVectorFormat(320 line_layer_out, file_name_out, "utf-8", None, "ESRI Shapefile")321 QgsVectorFileWriter.writeAsVectorFormat(322 polygon_in, file_name_poly_in, "utf-8", None, "ESRI Shapefile")323 QgsVectorFileWriter.writeAsVectorFormat(324 polygon_out, file_name_poly_out, "utf-8", None, "ESRI Shapefile")325 #merge layers326 in_features = line_layer_in.featureCount()327 out_features = line_layer_out.featureCount()328 if in_features > out_features:329 for feature in line_layer_out.getFeatures():330 line_layer_in.dataProvider().addFeatures([feature])331 return line_layer_in332 else:333 for feature in line_layer_in.getFeatures():334 line_layer_out.dataProvider().addFeatures([feature])335 return line_layer_out336def split_by_polygon2(337 vector,338 polygon_layer,339 request=QgsFeatureRequest(),340 use_contains_operation=False,341 mark_value=None):342 """Split objects from vector layer by polygon.343 If request is specified, filter the objects before splitting.344 If part of vector object lies in the polygon, mark it by mark_value (345 optional).346 :param vector: Vector layer347 :type vector: QgsVectorLayer348 :param polygon_layer: Splitting polygons layer349 :type polygon_layer: QgsVectorLayer350 :param request: Filter for vector objects351 :type request: QgsFeatureRequest352 :param use_contains_operation: Whether to use geometrical containment.353 :type use_contains_operation: bool354 :param mark_value: Field value to mark the objects.355 :type mark_value: (field_name, field_value).or None356 :returns: Vector layer with split geometry357 :rtype: QgsVectorLayer358 """359 def _set_feature(geometry, attributes):360 """361 Helper to create and set up feature362 """363 included_feature = QgsFeature()364 included_feature.setGeometry(geometry)365 included_feature.setAttributes(attributes)366 return included_feature367 def _update_attr_list(attributes, index, value, add_attribute=False):368 """369 Helper for update list of attributes.370 """371 new_attributes = attributes[:]372 if add_attribute:373 new_attributes.append(value)374 else:375 new_attributes[index] = value376 return new_attributes377 # Create layer to store the splitted objects378 result_layer = create_layer(vector)379 result_provider = result_layer.dataProvider()380 fields = result_provider.fields()381 # If target_field does not exist, add it:382 new_field_added = False383 if mark_value is not None:384 target_field = mark_value[0]385 if fields.indexFromName(target_field) == -1:386 result_layer.startEditing()387 result_provider.addAttributes(388 [QgsField(target_field, QVariant.Int)])389 new_field_added = True390 result_layer.commitChanges()391 target_value = None392 if mark_value is not None:393 target_field = mark_value[0]394 target_value = mark_value[1]395 target_field_index = result_provider.fieldNameIndex(target_field)396 if target_field_index == -1:397 raise WrongDataTypeException(398 'Field not found for %s' % target_field)399 # Start split procedure400 line_geoms = []401 line_attributes = []402 for initial_feature in vector.getFeatures(request):403 initial_geom = initial_feature.geometry()404 line_geoms.append(QgsGeometry(initial_geom))405 attributes = initial_feature.attributes()406 line_attributes.append(attributes)407 geometry_type = initial_geom.type()408 poly_geoms = []409 for polygon_feature in polygon_layer.getFeatures(request):410 polygon = polygon_feature.geometry()411 poly_geoms.append(QgsGeometry(polygon))412 result_layer.startEditing()413 for polygon in poly_geoms:414 for initial_geom, attributes in \415 itertools.izip(line_geoms, line_attributes):416 if use_contains_operation:417 poly_contains = polygon.contains(initial_geom)418 else:419 poly_contains = False420 poly_intersect = False421 if not poly_contains:422 poly_intersect = polygon.intersects(initial_geom)423 if poly_contains or poly_intersect:424 # Find parts of initial_geom, intersecting425 # with the polygon, then mark them if needed426 if poly_contains:427 g = initial_geom428 if mark_value is not None:429 new_attributes = _update_attr_list(430 attributes,431 target_field_index,432 target_value,433 add_attribute=new_field_added434 )435 else:436 new_attributes = attributes437 feature = _set_feature(g, new_attributes)438 _ = result_layer.dataProvider().addFeatures([feature])439 else:440 intersection = QgsGeometry(441 initial_geom.intersection(polygon)442 ).asGeometryCollection()443 for g in intersection:444 if g.type() == geometry_type:445 if mark_value is not None:446 new_attributes = _update_attr_list(447 attributes,448 target_field_index,449 target_value,450 add_attribute=new_field_added451 )452 else:453 new_attributes = attributes454 feature = _set_feature(g, new_attributes)455 _ = result_layer.dataProvider().\456 addFeatures([feature])457 result_layer.commitChanges()458 result_layer.updateExtents()...

Full Screen

Full Screen

InjectController.py

Source:InjectController.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2import os3import re4import chardet5from libs import Common, Message6__all__ = [7 'Injecter'8]9class Injecter:10 def __init__(self, options):11 self.__options__ = options12 self.mark_dict = {}13 if not self.detect(self.__options__['source_dirs']):14 Message.ShowError('无法成功定位所有需要的代码注入点, 程序终止!')15 Common.exit_with_pause(-1)16 else:17 Message.ShowStatus('已成功定位所有代码注入点.\n')18 def __detectCharset(self, filepath):19 '''20 给定一个文件路径, 获取该文本文件的编码21 '''22 with open(filepath, 'rb') as hfile:23 return chardet.detect(hfile.read())['encoding']24 def __searchMark(self, filename):25 line_num = 026 charset = self.__detectCharset(filename)27 regex = r'\s*?' + self.__options__['mark_format'] + r'\s*?'28 if '../../src/'.replace('/', os.path.sep) in filename and charset.upper() != 'UTF-8-SIG':29 Message.ShowWarning('期望文件 %s 的编码为 UTF-8-SIG 而实际上是 %s' % (filename, charset.upper()))30 return31 try:32 textfile = open(filename, encoding=charset)33 for line in textfile:34 line_num = line_num + 135 if '//' not in line:36 continue37 re_match = re.match(regex, line)38 if not re_match:39 continue40 if str(re_match.group(1)) in self.mark_dict:41 Message.ShowError('发现重复的代码注入标记: ' + re_match.group(0))42 Common.exit_with_pause(-1)43 self.mark_dict[re_match.group(1)] = {44 'index' : int(re_match.group(1)),45 'filepath' : filename,46 'line' : line_num47 }48 textfile.close()49 except Exception as err:50 Message.ShowError('文件 : %s | 错误信息 : %s' % (filename, err))51 def detect(self, src_dir):52 if isinstance(src_dir, str):53 src_dir = [src_dir]54 for single_dir in src_dir:55 for dirpath, _dirnames, filenames in os.walk(single_dir):56 for filename in filenames:57 _base_name, extension_name = os.path.splitext(filename.lower())58 if extension_name not in self.__options__['process_exts']:59 continue60 fullpath = os.path.normpath('%s/%s' % (dirpath, filename))61 self.__searchMark(fullpath)62 bMarkPassed = True63 for configure in self.__options__['mark_configure']:64 if str(int(configure['id'])) not in self.mark_dict:65 Message.ShowError('无法定位代码注入点: {index} : {constant} : {desc}'.format(66 index = str(int(configure['id'])),67 constant = str(configure['id']),68 desc = configure['desc']69 ))70 bMarkPassed = False71 return bMarkPassed72 def print(self):73 for _mark_index, mark_value in self.mark_dict.items():74 Message.ShowDebug('代码注入点 {index} : {constant} 位于文件 {filepath} : {line} 行.'.format(75 index = '%-2s' % mark_value['index'],76 constant = '%-40s' % str(self.__options__['mark_enum'](mark_value['index'])),77 filepath = mark_value['filepath'],78 line = mark_value['line']79 ))80 def insert(self, index, content):81 mark = self.mark_dict[str(int(index))]82 filepath = mark['filepath']83 insert_content = ('\n'.join(content)) + '\n'84 charset = self.__detectCharset(filepath)85 with open(filepath, encoding = charset) as rfile:86 filecontent = rfile.readlines()87 filecontent.insert(mark['line'] - 1, insert_content)88 with open(filepath, mode = 'w', encoding = charset) as wfile:89 wfile.writelines(filecontent)90 for mark_index, mark_value in self.mark_dict.items():91 if mark_index == index:92 continue93 if mark_value['filepath'].lower() != filepath.lower():94 continue95 if mark['line'] < mark_value['line']:...

Full Screen

Full Screen

selectQueries.py

Source:selectQueries.py Github

copy

Full Screen

1from dbfunctions import dbQuery;2def queryExams(year):3 query_string = '{}{}{}{}{}'.format("\4 SELECT exm_type, YEAR(exm_date), MONTH(exm_date), DAY(exm_date), d_name \5 FROM university.exams\6 JOIN university.disc_to_teachers\7 USING (dtt_instance_id)\8 JOIN university.disciplines\9 USING (d_id)\10 WHERE exm_date BETWEEN '",year,"-01-01' AND '",year+1,"-01-01'\11 ORDER BY exm_date, exm_type");12 query_rows_list = dbQuery(query_string);13 return query_rows_list;14def queryGroups(year):15 query_string = '{}{}{}'.format("\16 SELECT gr_id, students.stud_id, stud_surn, stud_name, stud_name2, stud_status\17 FROM university.students\18 JOIN university.stud_to_grps\19 ON university.students.stud_id = university.stud_to_grps.stud_id\20 WHERE year_study =",year,"\21 ORDER BY gr_id, stud_semester DESC, stud_surn, stud_name, stud_name2");22 query_rows_list = dbQuery(query_string);23 return query_rows_list24def queryDropped(year, semester):25 """26 year is integer like 2016, 2017, 201827 semester is short integer, 1 or 228 """29 if semester == 3:30 where_string = '{}{}'.format("WHERE year_study = ",year);31 else:32 where_string = '{}{}{}{}'.format("WHERE year_study = ",year," AND stud_semester = ",semester-1);33 query_string = '{}{}{}'.format("\34 SELECT gr_id, students.stud_id, stud_surn, stud_name, stud_name2, stud_status\35 FROM university.students\36 JOIN university.stud_to_grps\37 ON university.students.stud_id = university.stud_to_grps.stud_id\38 ",where_string,"\39 ORDER BY gr_id, stud_semester DESC, stud_surn, stud_name, stud_name2");40 query_rows_list = dbQuery(query_string);41 return query_rows_list;42def queryEvilTeachers(year, semester, min_count, mark_value):43 """44 year is integer like 2016, 2017, 2018, or string 'ALL'45 semester is short integer, 1 or 2, or 3 (both semesters)46 """47 #min_count = 148 #mark_value = 349 if semester == 1:50 lower_month = 4;51 upper_month = 8;52 elif semester == 2:53 lower_month = 10;54 upper_month = 12;55 elif semester == 3: #both semesters56 lower_month = 4;57 upper_month = 12;58 if year == 'ALL':59 where_string = '{}{}{}{}{}{}'.format("\60 WHERE MONTH(exm_date) BETWEEN ",lower_month," AND ",upper_month," AND mark_value = ",mark_value);61 else:62 where_string = '{}{}{}{}{}{}{}{}'.format("\63 WHERE YEAR(exm_date) = ",year,"\64 AND MONTH(exm_date) BETWEEN ",lower_month," AND ",upper_month,' AND mark_value = ', mark_value);65 print(where_string);66 query_string = '{}{}{}{}{}'.format("\67 SELECT t_surn, t_name, t_name2, COUNT(mark_id), mark_value\68 FROM university.teachers\69 JOIN university.disc_to_teachers\70 USING (t_no)\71 JOIN university.exams\72 USING (dtt_instance_id)\73 JOIN university.marks\74 USING (exm_id)",75 where_string, "\76 GROUP BY teachers.t_no, mark_value\77 HAVING COUNT(mark_id) >= ",min_count,"\78 ORDER BY mark_value, COUNT(mark_value) DESC, t_surn");79 query_rows_list = dbQuery(query_string);80 return query_rows_list;81#queryExams(2016)82#queryGroups(2016)83#queryDropped(2016, 2)...

Full Screen

Full Screen

tests.py

Source:tests.py Github

copy

Full Screen

1from base_app.tests import BaseTestCase2from django.urls import reverse3class MarkEndPointTestCase(BaseTestCase):4 def test_add_mark_to_task(self):5 course_id, lecture_id, task_statement_id, task_id = self.create_task()6 jwt = self.auth('qqq')7 data = {8 'mark_value': 9,9 }10 url = reverse(11 'mark-list',12 kwargs={13 'course_pk': course_id,14 'lecture_pk': lecture_id,15 'task_statement_pk': task_statement_id,16 'task_pk': task_id,17 }18 )19 resp, resp_data = self.post(url, data, jwt)20 assert resp.status_code == 20121 assert resp_data['mark_value'] == data['mark_value']22 assert self.users['qqq']['id'] == resp_data['author']['id']23 def test_add_mark_to_task_more_than_10(self):24 course_id, lecture_id, task_statement_id, task_id = self.create_task()25 jwt = self.auth('qqq')26 data = {27 'mark_value': 20,28 }29 url = reverse(30 'mark-list',31 kwargs={32 'course_pk': course_id,33 'lecture_pk': lecture_id,34 'task_statement_pk': task_statement_id,35 'task_pk': task_id,36 }37 )38 resp, resp_data = self.post(url, data, jwt)39 assert resp.status_code == 40040 assert 'ensure' in resp_data['mark_value'][0].lower()41 def test_get_mark_as_student(self):42 course_id, lecture_id, task_statement_id, task_id = self.create_task()43 jwt = self.auth('qqq')44 data = {45 'mark_value': 9,46 }47 url = reverse(48 'mark-list',49 kwargs={50 'course_pk': course_id,51 'lecture_pk': lecture_id,52 'task_statement_pk': task_statement_id,53 'task_pk': task_id,54 }55 )56 resp, resp_data = self.post(url, data, jwt)57 jwt = self.auth('new_student_2')58 url = reverse(59 'mark-detail',60 kwargs={61 'course_pk': course_id,62 'lecture_pk': lecture_id,63 'task_statement_pk': task_statement_id,64 'task_pk': task_id,65 'pk': resp_data["id"],66 }67 )68 resp, resp_data = self.get(url, data, jwt)69 assert resp.status_code == 20070 assert resp_data['mark_value'] == data['mark_value']...

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