Best Python code snippet using autotest_python
constructor.py
Source:constructor.py  
1__all__ = ['BaseConstructor', 'SafeConstructor', 'Constructor',2    'ConstructorError']3from error import *4from nodes import *5import datetime6import binascii, re, sys, types7class ConstructorError(MarkedYAMLError):8    pass9class BaseConstructor(object):10    yaml_constructors = {}11    yaml_multi_constructors = {}12    def __init__(self):13        self.constructed_objects = {}14        self.recursive_objects = {}15        self.state_generators = []16        self.deep_construct = False17    def check_data(self):18        # If there are more documents available?19        return self.check_node()20    def get_data(self):21        # Construct and return the next document.22        if self.check_node():23            return self.construct_document(self.get_node())24    def get_single_data(self):25        # Ensure that the stream contains a single document and construct it.26        node = self.get_single_node()27        if node is not None:28            return self.construct_document(node)29        return None30    def construct_document(self, node):31        data = self.construct_object(node)32        while self.state_generators:33            state_generators = self.state_generators34            self.state_generators = []35            for generator in state_generators:36                for dummy in generator:37                    pass38        self.constructed_objects = {}39        self.recursive_objects = {}40        self.deep_construct = False41        return data42    def construct_object(self, node, deep=False):43        if node in self.constructed_objects:44            return self.constructed_objects[node]45        if deep:46            old_deep = self.deep_construct47            self.deep_construct = True48        if node in self.recursive_objects:49            raise ConstructorError(None, None,50                    "found unconstructable recursive node", node.start_mark)51        self.recursive_objects[node] = None52        constructor = None53        tag_suffix = None54        if node.tag in self.yaml_constructors:55            constructor = self.yaml_constructors[node.tag]56        else:57            for tag_prefix in self.yaml_multi_constructors:58                if node.tag.startswith(tag_prefix):59                    tag_suffix = node.tag[len(tag_prefix):]60                    constructor = self.yaml_multi_constructors[tag_prefix]61                    break62            else:63                if None in self.yaml_multi_constructors:64                    tag_suffix = node.tag65                    constructor = self.yaml_multi_constructors[None]66                elif None in self.yaml_constructors:67                    constructor = self.yaml_constructors[None]68                elif isinstance(node, ScalarNode):69                    constructor = self.__class__.construct_scalar70                elif isinstance(node, SequenceNode):71                    constructor = self.__class__.construct_sequence72                elif isinstance(node, MappingNode):73                    constructor = self.__class__.construct_mapping74        if tag_suffix is None:75            data = constructor(self, node)76        else:77            data = constructor(self, tag_suffix, node)78        if isinstance(data, types.GeneratorType):79            generator = data80            data = generator.next()81            if self.deep_construct:82                for dummy in generator:83                    pass84            else:85                self.state_generators.append(generator)86        self.constructed_objects[node] = data87        del self.recursive_objects[node]88        if deep:89            self.deep_construct = old_deep90        return data91    def construct_scalar(self, node):92        if not isinstance(node, ScalarNode):93            raise ConstructorError(None, None,94                    "expected a scalar node, but found %s" % node.id,95                    node.start_mark)96        return node.value97    def construct_sequence(self, node, deep=False):98        if not isinstance(node, SequenceNode):99            raise ConstructorError(None, None,100                    "expected a sequence node, but found %s" % node.id,101                    node.start_mark)102        return [self.construct_object(child, deep=deep)103                for child in node.value]104    def construct_mapping(self, node, deep=False):105        if not isinstance(node, MappingNode):106            raise ConstructorError(None, None,107                    "expected a mapping node, but found %s" % node.id,108                    node.start_mark)109        mapping = {}110        for key_node, value_node in node.value:111            key = self.construct_object(key_node, deep=deep)112            try:113                hash(key)114            except TypeError, exc:115                raise ConstructorError("while constructing a mapping", node.start_mark,116                        "found unacceptable key (%s)" % exc, key_node.start_mark)117            value = self.construct_object(value_node, deep=deep)118            mapping[key] = value119        return mapping120    def construct_pairs(self, node, deep=False):121        if not isinstance(node, MappingNode):122            raise ConstructorError(None, None,123                    "expected a mapping node, but found %s" % node.id,124                    node.start_mark)125        pairs = []126        for key_node, value_node in node.value:127            key = self.construct_object(key_node, deep=deep)128            value = self.construct_object(value_node, deep=deep)129            pairs.append((key, value))130        return pairs131    def add_constructor(cls, tag, constructor):132        if not 'yaml_constructors' in cls.__dict__:133            cls.yaml_constructors = cls.yaml_constructors.copy()134        cls.yaml_constructors[tag] = constructor135    add_constructor = classmethod(add_constructor)136    def add_multi_constructor(cls, tag_prefix, multi_constructor):137        if not 'yaml_multi_constructors' in cls.__dict__:138            cls.yaml_multi_constructors = cls.yaml_multi_constructors.copy()139        cls.yaml_multi_constructors[tag_prefix] = multi_constructor140    add_multi_constructor = classmethod(add_multi_constructor)141class SafeConstructor(BaseConstructor):142    def construct_scalar(self, node):143        if isinstance(node, MappingNode):144            for key_node, value_node in node.value:145                if key_node.tag == u'tag:yaml.org,2002:value':146                    return self.construct_scalar(value_node)147        return BaseConstructor.construct_scalar(self, node)148    def flatten_mapping(self, node):149        merge = []150        index = 0151        while index < len(node.value):152            key_node, value_node = node.value[index]153            if key_node.tag == u'tag:yaml.org,2002:merge':154                del node.value[index]155                if isinstance(value_node, MappingNode):156                    self.flatten_mapping(value_node)157                    merge.extend(value_node.value)158                elif isinstance(value_node, SequenceNode):159                    submerge = []160                    for subnode in value_node.value:161                        if not isinstance(subnode, MappingNode):162                            raise ConstructorError("while constructing a mapping",163                                    node.start_mark,164                                    "expected a mapping for merging, but found %s"165                                    % subnode.id, subnode.start_mark)166                        self.flatten_mapping(subnode)167                        submerge.append(subnode.value)168                    submerge.reverse()169                    for value in submerge:170                        merge.extend(value)171                else:172                    raise ConstructorError("while constructing a mapping", node.start_mark,173                            "expected a mapping or list of mappings for merging, but found %s"174                            % value_node.id, value_node.start_mark)175            elif key_node.tag == u'tag:yaml.org,2002:value':176                key_node.tag = u'tag:yaml.org,2002:str'177                index += 1178            else:179                index += 1180        if merge:181            node.value = merge + node.value182    def construct_mapping(self, node, deep=False):183        if isinstance(node, MappingNode):184            self.flatten_mapping(node)185        return BaseConstructor.construct_mapping(self, node, deep=deep)186    def construct_yaml_null(self, node):187        self.construct_scalar(node)188        return None189    bool_values = {190        u'yes':     True,191        u'no':      False,192        u'true':    True,193        u'false':   False,194        u'on':      True,195        u'off':     False,196    }197    def construct_yaml_bool(self, node):198        value = self.construct_scalar(node)199        return self.bool_values[value.lower()]200    def construct_yaml_int(self, node):201        value = str(self.construct_scalar(node))202        value = value.replace('_', '')203        sign = +1204        if value[0] == '-':205            sign = -1206        if value[0] in '+-':207            value = value[1:]208        if value == '0':209            return 0210        elif value.startswith('0b'):211            return sign*int(value[2:], 2)212        elif value.startswith('0x'):213            return sign*int(value[2:], 16)214        elif value[0] == '0':215            return sign*int(value, 8)216        elif ':' in value:217            digits = [int(part) for part in value.split(':')]218            digits.reverse()219            base = 1220            value = 0221            for digit in digits:222                value += digit*base223                base *= 60224            return sign*value225        else:226            return sign*int(value)227    inf_value = 1e300228    while inf_value != inf_value*inf_value:229        inf_value *= inf_value230    nan_value = -inf_value/inf_value   # Trying to make a quiet NaN (like C99).231    def construct_yaml_float(self, node):232        value = str(self.construct_scalar(node))233        value = value.replace('_', '').lower()234        sign = +1235        if value[0] == '-':236            sign = -1237        if value[0] in '+-':238            value = value[1:]239        if value == '.inf':240            return sign*self.inf_value241        elif value == '.nan':242            return self.nan_value243        elif ':' in value:244            digits = [float(part) for part in value.split(':')]245            digits.reverse()246            base = 1247            value = 0.0248            for digit in digits:249                value += digit*base250                base *= 60251            return sign*value252        else:253            return sign*float(value)254    def construct_yaml_binary(self, node):255        value = self.construct_scalar(node)256        try:257            return str(value).decode('base64')258        except (binascii.Error, UnicodeEncodeError), exc:259            raise ConstructorError(None, None,260                    "failed to decode base64 data: %s" % exc, node.start_mark) 261    timestamp_regexp = re.compile(262            ur'''^(?P<year>[0-9][0-9][0-9][0-9])263                -(?P<month>[0-9][0-9]?)264                -(?P<day>[0-9][0-9]?)265                (?:(?:[Tt]|[ \t]+)266                (?P<hour>[0-9][0-9]?)267                :(?P<minute>[0-9][0-9])268                :(?P<second>[0-9][0-9])269                (?:\.(?P<fraction>[0-9]*))?270                (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?)271                (?::(?P<tz_minute>[0-9][0-9]))?))?)?$''', re.X)272    def construct_yaml_timestamp(self, node):273        value = self.construct_scalar(node)274        match = self.timestamp_regexp.match(node.value)275        values = match.groupdict()276        year = int(values['year'])277        month = int(values['month'])278        day = int(values['day'])279        if not values['hour']:280            return datetime.date(year, month, day)281        hour = int(values['hour'])282        minute = int(values['minute'])283        second = int(values['second'])284        fraction = 0285        if values['fraction']:286            fraction = values['fraction'][:6]287            while len(fraction) < 6:288                fraction += '0'289            fraction = int(fraction)290        delta = None291        if values['tz_sign']:292            tz_hour = int(values['tz_hour'])293            tz_minute = int(values['tz_minute'] or 0)294            delta = datetime.timedelta(hours=tz_hour, minutes=tz_minute)295            if values['tz_sign'] == '-':296                delta = -delta297        data = datetime.datetime(year, month, day, hour, minute, second, fraction)298        if delta:299            data -= delta300        return data301    def construct_yaml_omap(self, node):302        # Note: we do not check for duplicate keys, because it's too303        # CPU-expensive.304        omap = []305        yield omap306        if not isinstance(node, SequenceNode):307            raise ConstructorError("while constructing an ordered map", node.start_mark,308                    "expected a sequence, but found %s" % node.id, node.start_mark)309        for subnode in node.value:310            if not isinstance(subnode, MappingNode):311                raise ConstructorError("while constructing an ordered map", node.start_mark,312                        "expected a mapping of length 1, but found %s" % subnode.id,313                        subnode.start_mark)314            if len(subnode.value) != 1:315                raise ConstructorError("while constructing an ordered map", node.start_mark,316                        "expected a single mapping item, but found %d items" % len(subnode.value),317                        subnode.start_mark)318            key_node, value_node = subnode.value[0]319            key = self.construct_object(key_node)320            value = self.construct_object(value_node)321            omap.append((key, value))322    def construct_yaml_pairs(self, node):323        # Note: the same code as `construct_yaml_omap`.324        pairs = []325        yield pairs326        if not isinstance(node, SequenceNode):327            raise ConstructorError("while constructing pairs", node.start_mark,328                    "expected a sequence, but found %s" % node.id, node.start_mark)329        for subnode in node.value:330            if not isinstance(subnode, MappingNode):331                raise ConstructorError("while constructing pairs", node.start_mark,332                        "expected a mapping of length 1, but found %s" % subnode.id,333                        subnode.start_mark)334            if len(subnode.value) != 1:335                raise ConstructorError("while constructing pairs", node.start_mark,336                        "expected a single mapping item, but found %d items" % len(subnode.value),337                        subnode.start_mark)338            key_node, value_node = subnode.value[0]339            key = self.construct_object(key_node)340            value = self.construct_object(value_node)341            pairs.append((key, value))342    def construct_yaml_set(self, node):343        data = set()344        yield data345        value = self.construct_mapping(node)346        data.update(value)347    def construct_yaml_str(self, node):348        value = self.construct_scalar(node)349        try:350            return value.encode('ascii')351        except UnicodeEncodeError:352            return value353    def construct_yaml_seq(self, node):354        data = []355        yield data356        data.extend(self.construct_sequence(node))357    def construct_yaml_map(self, node):358        data = {}359        yield data360        value = self.construct_mapping(node)361        data.update(value)362    def construct_yaml_object(self, node, cls):363        data = cls.__new__(cls)364        yield data365        if hasattr(data, '__setstate__'):366            state = self.construct_mapping(node, deep=True)367            data.__setstate__(state)368        else:369            state = self.construct_mapping(node)370            data.__dict__.update(state)371    def construct_undefined(self, node):372        raise ConstructorError(None, None,373                "could not determine a constructor for the tag %r" % node.tag.encode('utf-8'),374                node.start_mark)375SafeConstructor.add_constructor(376        u'tag:yaml.org,2002:null',377        SafeConstructor.construct_yaml_null)378SafeConstructor.add_constructor(379        u'tag:yaml.org,2002:bool',380        SafeConstructor.construct_yaml_bool)381SafeConstructor.add_constructor(382        u'tag:yaml.org,2002:int',383        SafeConstructor.construct_yaml_int)384SafeConstructor.add_constructor(385        u'tag:yaml.org,2002:float',386        SafeConstructor.construct_yaml_float)387SafeConstructor.add_constructor(388        u'tag:yaml.org,2002:binary',389        SafeConstructor.construct_yaml_binary)390SafeConstructor.add_constructor(391        u'tag:yaml.org,2002:timestamp',392        SafeConstructor.construct_yaml_timestamp)393SafeConstructor.add_constructor(394        u'tag:yaml.org,2002:omap',395        SafeConstructor.construct_yaml_omap)396SafeConstructor.add_constructor(397        u'tag:yaml.org,2002:pairs',398        SafeConstructor.construct_yaml_pairs)399SafeConstructor.add_constructor(400        u'tag:yaml.org,2002:set',401        SafeConstructor.construct_yaml_set)402SafeConstructor.add_constructor(403        u'tag:yaml.org,2002:str',404        SafeConstructor.construct_yaml_str)405SafeConstructor.add_constructor(406        u'tag:yaml.org,2002:seq',407        SafeConstructor.construct_yaml_seq)408SafeConstructor.add_constructor(409        u'tag:yaml.org,2002:map',410        SafeConstructor.construct_yaml_map)411SafeConstructor.add_constructor(None,412        SafeConstructor.construct_undefined)413class Constructor(SafeConstructor):414    def construct_python_str(self, node):415        return self.construct_scalar(node).encode('utf-8')416    def construct_python_unicode(self, node):417        return self.construct_scalar(node)418    def construct_python_long(self, node):419        return long(self.construct_yaml_int(node))420    def construct_python_complex(self, node):421       return complex(self.construct_scalar(node))422    def construct_python_tuple(self, node):423        return tuple(self.construct_sequence(node))424    def find_python_module(self, name, mark):425        if not name:426            raise ConstructorError("while constructing a Python module", mark,427                    "expected non-empty name appended to the tag", mark)428        try:429            __import__(name)430        except ImportError, exc:431            raise ConstructorError("while constructing a Python module", mark,432                    "cannot find module %r (%s)" % (name.encode('utf-8'), exc), mark)433        return sys.modules[name]434    def find_python_name(self, name, mark):435        if not name:436            raise ConstructorError("while constructing a Python object", mark,437                    "expected non-empty name appended to the tag", mark)438        if u'.' in name:439            module_name, object_name = name.rsplit('.', 1)440        else:441            module_name = '__builtin__'442            object_name = name443        try:444            __import__(module_name)445        except ImportError, exc:446            raise ConstructorError("while constructing a Python object", mark,447                    "cannot find module %r (%s)" % (module_name.encode('utf-8'), exc), mark)448        module = sys.modules[module_name]449        if not hasattr(module, object_name):450            raise ConstructorError("while constructing a Python object", mark,451                    "cannot find %r in the module %r" % (object_name.encode('utf-8'),452                        module.__name__), mark)453        return getattr(module, object_name)454    def construct_python_name(self, suffix, node):455        value = self.construct_scalar(node)456        if value:457            raise ConstructorError("while constructing a Python name", node.start_mark,458                    "expected the empty value, but found %r" % value.encode('utf-8'),459                    node.start_mark)460        return self.find_python_name(suffix, node.start_mark)461    def construct_python_module(self, suffix, node):462        value = self.construct_scalar(node)463        if value:464            raise ConstructorError("while constructing a Python module", node.start_mark,465                    "expected the empty value, but found %r" % value.encode('utf-8'),466                    node.start_mark)467        return self.find_python_module(suffix, node.start_mark)468    class classobj: pass469    def make_python_instance(self, suffix, node,470            args=None, kwds=None, newobj=False):471        if not args:472            args = []473        if not kwds:474            kwds = {}475        cls = self.find_python_name(suffix, node.start_mark)476        if newobj and isinstance(cls, type(self.classobj))  \477                and not args and not kwds:478            instance = self.classobj()479            instance.__class__ = cls480            return instance481        elif newobj and isinstance(cls, type):482            return cls.__new__(cls, *args, **kwds)483        else:484            return cls(*args, **kwds)485    def set_python_instance_state(self, instance, state):486        if hasattr(instance, '__setstate__'):487            instance.__setstate__(state)488        else:489            slotstate = {}490            if isinstance(state, tuple) and len(state) == 2:491                state, slotstate = state492            if hasattr(instance, '__dict__'):493                instance.__dict__.update(state)494            elif state:495                slotstate.update(state)496            for key, value in slotstate.items():497                setattr(object, key, value)498    def construct_python_object(self, suffix, node):499        # Format:500        #   !!python/object:module.name { ... state ... }501        instance = self.make_python_instance(suffix, node, newobj=True)502        yield instance503        deep = hasattr(instance, '__setstate__')504        state = self.construct_mapping(node, deep=deep)505        self.set_python_instance_state(instance, state)506    def construct_python_object_apply(self, suffix, node, newobj=False):507        # Format:508        #   !!python/object/apply       # (or !!python/object/new)509        #   args: [ ... arguments ... ]510        #   kwds: { ... keywords ... }511        #   state: ... state ...512        #   listitems: [ ... listitems ... ]513        #   dictitems: { ... dictitems ... }514        # or short format:515        #   !!python/object/apply [ ... arguments ... ]516        # The difference between !!python/object/apply and !!python/object/new517        # is how an object is created, check make_python_instance for details.518        if isinstance(node, SequenceNode):519            args = self.construct_sequence(node, deep=True)520            kwds = {}521            state = {}522            listitems = []523            dictitems = {}524        else:525            value = self.construct_mapping(node, deep=True)526            args = value.get('args', [])527            kwds = value.get('kwds', {})528            state = value.get('state', {})529            listitems = value.get('listitems', [])530            dictitems = value.get('dictitems', {})531        instance = self.make_python_instance(suffix, node, args, kwds, newobj)532        if state:533            self.set_python_instance_state(instance, state)534        if listitems:535            instance.extend(listitems)536        if dictitems:537            for key in dictitems:538                instance[key] = dictitems[key]539        return instance540    def construct_python_object_new(self, suffix, node):541        return self.construct_python_object_apply(suffix, node, newobj=True)542Constructor.add_constructor(543    u'tag:yaml.org,2002:python/none',544    Constructor.construct_yaml_null)545Constructor.add_constructor(546    u'tag:yaml.org,2002:python/bool',547    Constructor.construct_yaml_bool)548Constructor.add_constructor(549    u'tag:yaml.org,2002:python/str',550    Constructor.construct_python_str)551Constructor.add_constructor(552    u'tag:yaml.org,2002:python/unicode',553    Constructor.construct_python_unicode)554Constructor.add_constructor(555    u'tag:yaml.org,2002:python/int',556    Constructor.construct_yaml_int)557Constructor.add_constructor(558    u'tag:yaml.org,2002:python/long',559    Constructor.construct_python_long)560Constructor.add_constructor(561    u'tag:yaml.org,2002:python/float',562    Constructor.construct_yaml_float)563Constructor.add_constructor(564    u'tag:yaml.org,2002:python/complex',565    Constructor.construct_python_complex)566Constructor.add_constructor(567    u'tag:yaml.org,2002:python/list',568    Constructor.construct_yaml_seq)569Constructor.add_constructor(570    u'tag:yaml.org,2002:python/tuple',571    Constructor.construct_python_tuple)572Constructor.add_constructor(573    u'tag:yaml.org,2002:python/dict',574    Constructor.construct_yaml_map)575Constructor.add_multi_constructor(576    u'tag:yaml.org,2002:python/name:',577    Constructor.construct_python_name)578Constructor.add_multi_constructor(579    u'tag:yaml.org,2002:python/module:',580    Constructor.construct_python_module)581Constructor.add_multi_constructor(582    u'tag:yaml.org,2002:python/object:',583    Constructor.construct_python_object)584Constructor.add_multi_constructor(585    u'tag:yaml.org,2002:python/object/apply:',586    Constructor.construct_python_object_apply)587Constructor.add_multi_constructor(588    u'tag:yaml.org,2002:python/object/new:',...constructor.pyi
Source:constructor.pyi  
1from yaml.error import Mark, YAMLError, MarkedYAMLError2from yaml.nodes import Node, ScalarNode, CollectionNode, SequenceNode, MappingNode3from typing import Any4class ConstructorError(MarkedYAMLError): ...5class BaseConstructor:6    yaml_constructors: Any7    yaml_multi_constructors: Any8    constructed_objects: Any9    recursive_objects: Any10    state_generators: Any11    deep_construct: Any12    def __init__(self) -> None: ...13    def check_data(self): ...14    def get_data(self): ...15    def get_single_data(self): ...16    def construct_document(self, node): ...17    def construct_object(self, node, deep=...): ...18    def construct_scalar(self, node): ...19    def construct_sequence(self, node, deep=...): ...20    def construct_mapping(self, node, deep=...): ...21    def construct_pairs(self, node, deep=...): ...22    @classmethod23    def add_constructor(cls, tag, constructor): ...24    @classmethod25    def add_multi_constructor(cls, tag_prefix, multi_constructor): ...26class SafeConstructor(BaseConstructor):27    def construct_scalar(self, node): ...28    def flatten_mapping(self, node): ...29    def construct_mapping(self, node, deep=...): ...30    def construct_yaml_null(self, node): ...31    bool_values: Any32    def construct_yaml_bool(self, node): ...33    def construct_yaml_int(self, node): ...34    inf_value: Any35    nan_value: Any36    def construct_yaml_float(self, node): ...37    def construct_yaml_binary(self, node): ...38    timestamp_regexp: Any39    def construct_yaml_timestamp(self, node): ...40    def construct_yaml_omap(self, node): ...41    def construct_yaml_pairs(self, node): ...42    def construct_yaml_set(self, node): ...43    def construct_yaml_str(self, node): ...44    def construct_yaml_seq(self, node): ...45    def construct_yaml_map(self, node): ...46    def construct_yaml_object(self, node, cls): ...47    def construct_undefined(self, node): ...48class FullConstructor(SafeConstructor):49    def construct_python_str(self, node): ...50    def construct_python_unicode(self, node): ...51    def construct_python_bytes(self, node): ...52    def construct_python_long(self, node): ...53    def construct_python_complex(self, node): ...54    def construct_python_tuple(self, node): ...55    def find_python_module(self, name, mark, unsafe=...): ...56    def find_python_name(self, name, mark, unsafe=...): ...57    def construct_python_name(self, suffix, node): ...58    def construct_python_module(self, suffix, node): ...59    def make_python_instance(self, suffix, node, args=..., kwds=..., newobj=..., unsafe=...): ...60    def set_python_instance_state(self, instance, state): ...61    def construct_python_object(self, suffix, node): ...62    def construct_python_object_apply(self, suffix, node, newobj=...): ...63    def construct_python_object_new(self, suffix, node): ...64class Constructor(SafeConstructor):65    def construct_python_str(self, node): ...66    def construct_python_unicode(self, node): ...67    def construct_python_long(self, node): ...68    def construct_python_complex(self, node): ...69    def construct_python_tuple(self, node): ...70    def find_python_module(self, name, mark): ...71    def find_python_name(self, name, mark): ...72    def construct_python_name(self, suffix, node): ...73    def construct_python_module(self, suffix, node): ...74    class classobj: ...75    def make_python_instance(self, suffix, node, args=..., kwds=..., newobj=...): ...76    def set_python_instance_state(self, instance, state): ...77    def construct_python_object(self, suffix, node): ...78    def construct_python_object_apply(self, suffix, node, newobj=...): ......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!!
