Best Python code snippet using fMBT_python
property_content.py
Source:property_content.py  
1# coding: utf-82"""3    Rapid4    EPS Rapid V2.3  # noqa: E5015    OpenAPI spec version: 2.36    7    Generated by: https://github.com/swagger-api/swagger-codegen.git8"""9import pprint10import re  # noqa: F40111import six12from eps_rapid.models.amenity import Amenity  # noqa: F401,E50113from eps_rapid.models.brand import Brand  # noqa: F401,E50114from eps_rapid.models.chain import Chain  # noqa: F401,E50115from eps_rapid.models.property_content_address import PropertyContentAddress  # noqa: F401,E50116from eps_rapid.models.property_content_airports import PropertyContentAirports  # noqa: F401,E50117from eps_rapid.models.property_content_all_inclusive import PropertyContentAllInclusive  # noqa: F401,E50118from eps_rapid.models.property_content_attributes import PropertyContentAttributes  # noqa: F401,E50119from eps_rapid.models.property_content_business_model import PropertyContentBusinessModel  # noqa: F401,E50120from eps_rapid.models.property_content_category import PropertyContentCategory  # noqa: F401,E50121from eps_rapid.models.property_content_checkin import PropertyContentCheckin  # noqa: F401,E50122from eps_rapid.models.property_content_checkout import PropertyContentCheckout  # noqa: F401,E50123from eps_rapid.models.property_content_dates import PropertyContentDates  # noqa: F401,E50124from eps_rapid.models.property_content_descriptions import PropertyContentDescriptions  # noqa: F401,E50125from eps_rapid.models.property_content_fees import PropertyContentFees  # noqa: F401,E50126from eps_rapid.models.property_content_images import PropertyContentImages  # noqa: F401,E50127from eps_rapid.models.property_content_location import PropertyContentLocation  # noqa: F401,E50128from eps_rapid.models.property_content_onsite_payments import PropertyContentOnsitePayments  # noqa: F401,E50129from eps_rapid.models.property_content_policies import PropertyContentPolicies  # noqa: F401,E50130from eps_rapid.models.property_content_ratings import PropertyContentRatings  # noqa: F401,E50131from eps_rapid.models.rate_content import RateContent  # noqa: F401,E50132from eps_rapid.models.room_content import RoomContent  # noqa: F401,E50133from eps_rapid.models.spoken_language import SpokenLanguage  # noqa: F401,E50134from eps_rapid.models.statistic import Statistic  # noqa: F401,E50135from eps_rapid.models.theme import Theme  # noqa: F401,E50136class PropertyContent(object):37    """NOTE: This class is auto generated by the swagger code generator program.38    Do not edit the class manually.39    """40    """41    Attributes:42      swagger_types (dict): The key is attribute name43                            and the value is attribute type.44      attribute_map (dict): The key is attribute name45                            and the value is json key in definition.46    """47    swagger_types = {48        'property_id': 'str',49        'name': 'str',50        'address': 'PropertyContentAddress',51        'ratings': 'PropertyContentRatings',52        'location': 'PropertyContentLocation',53        'phone': 'str',54        'fax': 'str',55        'category': 'PropertyContentCategory',56        'business_model': 'PropertyContentBusinessModel',57        'rank': 'float',58        'checkin': 'PropertyContentCheckin',59        'checkout': 'PropertyContentCheckout',60        'fees': 'PropertyContentFees',61        'policies': 'PropertyContentPolicies',62        'attributes': 'PropertyContentAttributes',63        'amenities': 'dict(str, Amenity)',64        'images': 'list[PropertyContentImages]',65        'onsite_payments': 'PropertyContentOnsitePayments',66        'rooms': 'dict(str, RoomContent)',67        'rates': 'dict(str, RateContent)',68        'dates': 'PropertyContentDates',69        'descriptions': 'PropertyContentDescriptions',70        'statistics': 'dict(str, Statistic)',71        'airports': 'PropertyContentAirports',72        'registry_number': 'str',73        'themes': 'dict(str, Theme)',74        'all_inclusive': 'PropertyContentAllInclusive',75        'tax_id': 'str',76        'chain': 'Chain',77        'brand': 'Brand',78        'spoken_languages': 'dict(str, SpokenLanguage)',79        'multi_unit': 'bool'80    }81    attribute_map = {82        'property_id': 'property_id',83        'name': 'name',84        'address': 'address',85        'ratings': 'ratings',86        'location': 'location',87        'phone': 'phone',88        'fax': 'fax',89        'category': 'category',90        'business_model': 'business_model',91        'rank': 'rank',92        'checkin': 'checkin',93        'checkout': 'checkout',94        'fees': 'fees',95        'policies': 'policies',96        'attributes': 'attributes',97        'amenities': 'amenities',98        'images': 'images',99        'onsite_payments': 'onsite_payments',100        'rooms': 'rooms',101        'rates': 'rates',102        'dates': 'dates',103        'descriptions': 'descriptions',104        'statistics': 'statistics',105        'airports': 'airports',106        'registry_number': 'registry_number',107        'themes': 'themes',108        'all_inclusive': 'all_inclusive',109        'tax_id': 'tax_id',110        'chain': 'chain',111        'brand': 'brand',112        'spoken_languages': 'spoken_languages',113        'multi_unit': 'multi_unit'114    }115    def __init__(self, property_id=None, name=None, address=None, ratings=None, location=None, phone=None, fax=None, category=None, business_model=None, rank=None, checkin=None, checkout=None, fees=None, policies=None, attributes=None, amenities=None, images=None, onsite_payments=None, rooms=None, rates=None, dates=None, descriptions=None, statistics=None, airports=None, registry_number=None, themes=None, all_inclusive=None, tax_id=None, chain=None, brand=None, spoken_languages=None, multi_unit=None):  # noqa: E501116        """PropertyContent - a model defined in Swagger"""  # noqa: E501117        self._property_id = None118        self._name = None119        self._address = None120        self._ratings = None121        self._location = None122        self._phone = None123        self._fax = None124        self._category = None125        self._business_model = None126        self._rank = None127        self._checkin = None128        self._checkout = None129        self._fees = None130        self._policies = None131        self._attributes = None132        self._amenities = None133        self._images = None134        self._onsite_payments = None135        self._rooms = None136        self._rates = None137        self._dates = None138        self._descriptions = None139        self._statistics = None140        self._airports = None141        self._registry_number = None142        self._themes = None143        self._all_inclusive = None144        self._tax_id = None145        self._chain = None146        self._brand = None147        self._spoken_languages = None148        self._multi_unit = None149        self.discriminator = None150        if property_id is not None:151            self.property_id = property_id152        if name is not None:153            self.name = name154        if address is not None:155            self.address = address156        if ratings is not None:157            self.ratings = ratings158        if location is not None:159            self.location = location160        if phone is not None:161            self.phone = phone162        if fax is not None:163            self.fax = fax164        if category is not None:165            self.category = category166        if business_model is not None:167            self.business_model = business_model168        if rank is not None:169            self.rank = rank170        if checkin is not None:171            self.checkin = checkin172        if checkout is not None:173            self.checkout = checkout174        if fees is not None:175            self.fees = fees176        if policies is not None:177            self.policies = policies178        if attributes is not None:179            self.attributes = attributes180        if amenities is not None:181            self.amenities = amenities182        if images is not None:183            self.images = images184        if onsite_payments is not None:185            self.onsite_payments = onsite_payments186        if rooms is not None:187            self.rooms = rooms188        if rates is not None:189            self.rates = rates190        if dates is not None:191            self.dates = dates192        if descriptions is not None:193            self.descriptions = descriptions194        if statistics is not None:195            self.statistics = statistics196        if airports is not None:197            self.airports = airports198        if registry_number is not None:199            self.registry_number = registry_number200        if themes is not None:201            self.themes = themes202        if all_inclusive is not None:203            self.all_inclusive = all_inclusive204        if tax_id is not None:205            self.tax_id = tax_id206        if chain is not None:207            self.chain = chain208        if brand is not None:209            self.brand = brand210        if spoken_languages is not None:211            self.spoken_languages = spoken_languages212        if multi_unit is not None:213            self.multi_unit = multi_unit214    @property215    def property_id(self):216        """Gets the property_id of this PropertyContent.  # noqa: E501217        Unique Expedia property ID.  # noqa: E501218        :return: The property_id of this PropertyContent.  # noqa: E501219        :rtype: str220        """221        return self._property_id222    @property_id.setter223    def property_id(self, property_id):224        """Sets the property_id of this PropertyContent.225        Unique Expedia property ID.  # noqa: E501226        :param property_id: The property_id of this PropertyContent.  # noqa: E501227        :type: str228        """229        self._property_id = property_id230    @property231    def name(self):232        """Gets the name of this PropertyContent.  # noqa: E501233        Property name.  # noqa: E501234        :return: The name of this PropertyContent.  # noqa: E501235        :rtype: str236        """237        return self._name238    @name.setter239    def name(self, name):240        """Sets the name of this PropertyContent.241        Property name.  # noqa: E501242        :param name: The name of this PropertyContent.  # noqa: E501243        :type: str244        """245        self._name = name246    @property247    def address(self):248        """Gets the address of this PropertyContent.  # noqa: E501249        :return: The address of this PropertyContent.  # noqa: E501250        :rtype: PropertyContentAddress251        """252        return self._address253    @address.setter254    def address(self, address):255        """Sets the address of this PropertyContent.256        :param address: The address of this PropertyContent.  # noqa: E501257        :type: PropertyContentAddress258        """259        self._address = address260    @property261    def ratings(self):262        """Gets the ratings of this PropertyContent.  # noqa: E501263        :return: The ratings of this PropertyContent.  # noqa: E501264        :rtype: PropertyContentRatings265        """266        return self._ratings267    @ratings.setter268    def ratings(self, ratings):269        """Sets the ratings of this PropertyContent.270        :param ratings: The ratings of this PropertyContent.  # noqa: E501271        :type: PropertyContentRatings272        """273        self._ratings = ratings274    @property275    def location(self):276        """Gets the location of this PropertyContent.  # noqa: E501277        :return: The location of this PropertyContent.  # noqa: E501278        :rtype: PropertyContentLocation279        """280        return self._location281    @location.setter282    def location(self, location):283        """Sets the location of this PropertyContent.284        :param location: The location of this PropertyContent.  # noqa: E501285        :type: PropertyContentLocation286        """287        self._location = location288    @property289    def phone(self):290        """Gets the phone of this PropertyContent.  # noqa: E501291        The property's phone number.  # noqa: E501292        :return: The phone of this PropertyContent.  # noqa: E501293        :rtype: str294        """295        return self._phone296    @phone.setter297    def phone(self, phone):298        """Sets the phone of this PropertyContent.299        The property's phone number.  # noqa: E501300        :param phone: The phone of this PropertyContent.  # noqa: E501301        :type: str302        """303        self._phone = phone304    @property305    def fax(self):306        """Gets the fax of this PropertyContent.  # noqa: E501307        The property's fax number.  # noqa: E501308        :return: The fax of this PropertyContent.  # noqa: E501309        :rtype: str310        """311        return self._fax312    @fax.setter313    def fax(self, fax):314        """Sets the fax of this PropertyContent.315        The property's fax number.  # noqa: E501316        :param fax: The fax of this PropertyContent.  # noqa: E501317        :type: str318        """319        self._fax = fax320    @property321    def category(self):322        """Gets the category of this PropertyContent.  # noqa: E501323        :return: The category of this PropertyContent.  # noqa: E501324        :rtype: PropertyContentCategory325        """326        return self._category327    @category.setter328    def category(self, category):329        """Sets the category of this PropertyContent.330        :param category: The category of this PropertyContent.  # noqa: E501331        :type: PropertyContentCategory332        """333        self._category = category334    @property335    def business_model(self):336        """Gets the business_model of this PropertyContent.  # noqa: E501337        :return: The business_model of this PropertyContent.  # noqa: E501338        :rtype: PropertyContentBusinessModel339        """340        return self._business_model341    @business_model.setter342    def business_model(self, business_model):343        """Sets the business_model of this PropertyContent.344        :param business_model: The business_model of this PropertyContent.  # noqa: E501345        :type: PropertyContentBusinessModel346        """347        self._business_model = business_model348    @property349    def rank(self):350        """Gets the rank of this PropertyContent.  # noqa: E501351        The propertyâs rank across all properties. This value sorts properties based on EPS transactional data and details about the property, with 1 indicating the best-performing property and others following in ascending numerical order.  # noqa: E501352        :return: The rank of this PropertyContent.  # noqa: E501353        :rtype: float354        """355        return self._rank356    @rank.setter357    def rank(self, rank):358        """Sets the rank of this PropertyContent.359        The propertyâs rank across all properties. This value sorts properties based on EPS transactional data and details about the property, with 1 indicating the best-performing property and others following in ascending numerical order.  # noqa: E501360        :param rank: The rank of this PropertyContent.  # noqa: E501361        :type: float362        """363        self._rank = rank364    @property365    def checkin(self):366        """Gets the checkin of this PropertyContent.  # noqa: E501367        :return: The checkin of this PropertyContent.  # noqa: E501368        :rtype: PropertyContentCheckin369        """370        return self._checkin371    @checkin.setter372    def checkin(self, checkin):373        """Sets the checkin of this PropertyContent.374        :param checkin: The checkin of this PropertyContent.  # noqa: E501375        :type: PropertyContentCheckin376        """377        self._checkin = checkin378    @property379    def checkout(self):380        """Gets the checkout of this PropertyContent.  # noqa: E501381        :return: The checkout of this PropertyContent.  # noqa: E501382        :rtype: PropertyContentCheckout383        """384        return self._checkout385    @checkout.setter386    def checkout(self, checkout):387        """Sets the checkout of this PropertyContent.388        :param checkout: The checkout of this PropertyContent.  # noqa: E501389        :type: PropertyContentCheckout390        """391        self._checkout = checkout392    @property393    def fees(self):394        """Gets the fees of this PropertyContent.  # noqa: E501395        :return: The fees of this PropertyContent.  # noqa: E501396        :rtype: PropertyContentFees397        """398        return self._fees399    @fees.setter400    def fees(self, fees):401        """Sets the fees of this PropertyContent.402        :param fees: The fees of this PropertyContent.  # noqa: E501403        :type: PropertyContentFees404        """405        self._fees = fees406    @property407    def policies(self):408        """Gets the policies of this PropertyContent.  # noqa: E501409        :return: The policies of this PropertyContent.  # noqa: E501410        :rtype: PropertyContentPolicies411        """412        return self._policies413    @policies.setter414    def policies(self, policies):415        """Sets the policies of this PropertyContent.416        :param policies: The policies of this PropertyContent.  # noqa: E501417        :type: PropertyContentPolicies418        """419        self._policies = policies420    @property421    def attributes(self):422        """Gets the attributes of this PropertyContent.  # noqa: E501423        :return: The attributes of this PropertyContent.  # noqa: E501424        :rtype: PropertyContentAttributes425        """426        return self._attributes427    @attributes.setter428    def attributes(self, attributes):429        """Sets the attributes of this PropertyContent.430        :param attributes: The attributes of this PropertyContent.  # noqa: E501431        :type: PropertyContentAttributes432        """433        self._attributes = attributes434    @property435    def amenities(self):436        """Gets the amenities of this PropertyContent.  # noqa: E501437        Lists all of the amenities available for all guests at the property. See our [amenities reference](https://developer.expediapartnersolutions.com/reference/content-reference-lists-2-3/) for current known amenity ID and name values.  # noqa: E501438        :return: The amenities of this PropertyContent.  # noqa: E501439        :rtype: dict(str, Amenity)440        """441        return self._amenities442    @amenities.setter443    def amenities(self, amenities):444        """Sets the amenities of this PropertyContent.445        Lists all of the amenities available for all guests at the property. See our [amenities reference](https://developer.expediapartnersolutions.com/reference/content-reference-lists-2-3/) for current known amenity ID and name values.  # noqa: E501446        :param amenities: The amenities of this PropertyContent.  # noqa: E501447        :type: dict(str, Amenity)448        """449        self._amenities = amenities450    @property451    def images(self):452        """Gets the images of this PropertyContent.  # noqa: E501453        Contains all property images available.  # noqa: E501454        :return: The images of this PropertyContent.  # noqa: E501455        :rtype: list[PropertyContentImages]456        """457        return self._images458    @images.setter459    def images(self, images):460        """Sets the images of this PropertyContent.461        Contains all property images available.  # noqa: E501462        :param images: The images of this PropertyContent.  # noqa: E501463        :type: list[PropertyContentImages]464        """465        self._images = images466    @property467    def onsite_payments(self):468        """Gets the onsite_payments of this PropertyContent.  # noqa: E501469        :return: The onsite_payments of this PropertyContent.  # noqa: E501470        :rtype: PropertyContentOnsitePayments471        """472        return self._onsite_payments473    @onsite_payments.setter474    def onsite_payments(self, onsite_payments):475        """Sets the onsite_payments of this PropertyContent.476        :param onsite_payments: The onsite_payments of this PropertyContent.  # noqa: E501477        :type: PropertyContentOnsitePayments478        """479        self._onsite_payments = onsite_payments480    @property481    def rooms(self):482        """Gets the rooms of this PropertyContent.  # noqa: E501483        Information about all of the rooms at the property.  # noqa: E501484        :return: The rooms of this PropertyContent.  # noqa: E501485        :rtype: dict(str, RoomContent)486        """487        return self._rooms488    @rooms.setter489    def rooms(self, rooms):490        """Sets the rooms of this PropertyContent.491        Information about all of the rooms at the property.  # noqa: E501492        :param rooms: The rooms of this PropertyContent.  # noqa: E501493        :type: dict(str, RoomContent)494        """495        self._rooms = rooms496    @property497    def rates(self):498        """Gets the rates of this PropertyContent.  # noqa: E501499        Additional information about the rates offered by the property. This should be used in conjunction with the pricing and other rate-related information in shopping.  # noqa: E501500        :return: The rates of this PropertyContent.  # noqa: E501501        :rtype: dict(str, RateContent)502        """503        return self._rates504    @rates.setter505    def rates(self, rates):506        """Sets the rates of this PropertyContent.507        Additional information about the rates offered by the property. This should be used in conjunction with the pricing and other rate-related information in shopping.  # noqa: E501508        :param rates: The rates of this PropertyContent.  # noqa: E501509        :type: dict(str, RateContent)510        """511        self._rates = rates512    @property513    def dates(self):514        """Gets the dates of this PropertyContent.  # noqa: E501515        :return: The dates of this PropertyContent.  # noqa: E501516        :rtype: PropertyContentDates517        """518        return self._dates519    @dates.setter520    def dates(self, dates):521        """Sets the dates of this PropertyContent.522        :param dates: The dates of this PropertyContent.  # noqa: E501523        :type: PropertyContentDates524        """525        self._dates = dates526    @property527    def descriptions(self):528        """Gets the descriptions of this PropertyContent.  # noqa: E501529        :return: The descriptions of this PropertyContent.  # noqa: E501530        :rtype: PropertyContentDescriptions531        """532        return self._descriptions533    @descriptions.setter534    def descriptions(self, descriptions):535        """Sets the descriptions of this PropertyContent.536        :param descriptions: The descriptions of this PropertyContent.  # noqa: E501537        :type: PropertyContentDescriptions538        """539        self._descriptions = descriptions540    @property541    def statistics(self):542        """Gets the statistics of this PropertyContent.  # noqa: E501543        Statistics of the property, such as number of floors. See our [statistics reference](https://developer.expediapartnersolutions.com/reference/content-reference-lists-2-3/) for current known statistics ID and name values.  # noqa: E501544        :return: The statistics of this PropertyContent.  # noqa: E501545        :rtype: dict(str, Statistic)546        """547        return self._statistics548    @statistics.setter549    def statistics(self, statistics):550        """Sets the statistics of this PropertyContent.551        Statistics of the property, such as number of floors. See our [statistics reference](https://developer.expediapartnersolutions.com/reference/content-reference-lists-2-3/) for current known statistics ID and name values.  # noqa: E501552        :param statistics: The statistics of this PropertyContent.  # noqa: E501553        :type: dict(str, Statistic)554        """555        self._statistics = statistics556    @property557    def airports(self):558        """Gets the airports of this PropertyContent.  # noqa: E501559        :return: The airports of this PropertyContent.  # noqa: E501560        :rtype: PropertyContentAirports561        """562        return self._airports563    @airports.setter564    def airports(self, airports):565        """Sets the airports of this PropertyContent.566        :param airports: The airports of this PropertyContent.  # noqa: E501567        :type: PropertyContentAirports568        """569        self._airports = airports570    @property571    def registry_number(self):572        """Gets the registry_number of this PropertyContent.  # noqa: E501573        The property's registry number required by some jurisdictions.  # noqa: E501574        :return: The registry_number of this PropertyContent.  # noqa: E501575        :rtype: str576        """577        return self._registry_number578    @registry_number.setter579    def registry_number(self, registry_number):580        """Sets the registry_number of this PropertyContent.581        The property's registry number required by some jurisdictions.  # noqa: E501582        :param registry_number: The registry_number of this PropertyContent.  # noqa: E501583        :type: str584        """585        self._registry_number = registry_number586    @property587    def themes(self):588        """Gets the themes of this PropertyContent.  # noqa: E501589        Themes that describe the property. See our [themes reference](https://developer.expediapartnersolutions.com/reference/content-reference-lists-2-3/) for current known theme ID and name values.  # noqa: E501590        :return: The themes of this PropertyContent.  # noqa: E501591        :rtype: dict(str, Theme)592        """593        return self._themes594    @themes.setter595    def themes(self, themes):596        """Sets the themes of this PropertyContent.597        Themes that describe the property. See our [themes reference](https://developer.expediapartnersolutions.com/reference/content-reference-lists-2-3/) for current known theme ID and name values.  # noqa: E501598        :param themes: The themes of this PropertyContent.  # noqa: E501599        :type: dict(str, Theme)600        """601        self._themes = themes602    @property603    def all_inclusive(self):604        """Gets the all_inclusive of this PropertyContent.  # noqa: E501605        :return: The all_inclusive of this PropertyContent.  # noqa: E501606        :rtype: PropertyContentAllInclusive607        """608        return self._all_inclusive609    @all_inclusive.setter610    def all_inclusive(self, all_inclusive):611        """Sets the all_inclusive of this PropertyContent.612        :param all_inclusive: The all_inclusive of this PropertyContent.  # noqa: E501613        :type: PropertyContentAllInclusive614        """615        self._all_inclusive = all_inclusive616    @property617    def tax_id(self):618        """Gets the tax_id of this PropertyContent.  # noqa: E501619        Tax ID.  # noqa: E501620        :return: The tax_id of this PropertyContent.  # noqa: E501621        :rtype: str622        """623        return self._tax_id624    @tax_id.setter625    def tax_id(self, tax_id):626        """Sets the tax_id of this PropertyContent.627        Tax ID.  # noqa: E501628        :param tax_id: The tax_id of this PropertyContent.  # noqa: E501629        :type: str630        """631        self._tax_id = tax_id632    @property633    def chain(self):634        """Gets the chain of this PropertyContent.  # noqa: E501635        :return: The chain of this PropertyContent.  # noqa: E501636        :rtype: Chain637        """638        return self._chain639    @chain.setter640    def chain(self, chain):641        """Sets the chain of this PropertyContent.642        :param chain: The chain of this PropertyContent.  # noqa: E501643        :type: Chain644        """645        self._chain = chain646    @property647    def brand(self):648        """Gets the brand of this PropertyContent.  # noqa: E501649        :return: The brand of this PropertyContent.  # noqa: E501650        :rtype: Brand651        """652        return self._brand653    @brand.setter654    def brand(self, brand):655        """Sets the brand of this PropertyContent.656        :param brand: The brand of this PropertyContent.  # noqa: E501657        :type: Brand658        """659        self._brand = brand660    @property661    def spoken_languages(self):662        """Gets the spoken_languages of this PropertyContent.  # noqa: E501663        Languages spoken at the property.  # noqa: E501664        :return: The spoken_languages of this PropertyContent.  # noqa: E501665        :rtype: dict(str, SpokenLanguage)666        """667        return self._spoken_languages668    @spoken_languages.setter669    def spoken_languages(self, spoken_languages):670        """Sets the spoken_languages of this PropertyContent.671        Languages spoken at the property.  # noqa: E501672        :param spoken_languages: The spoken_languages of this PropertyContent.  # noqa: E501673        :type: dict(str, SpokenLanguage)674        """675        self._spoken_languages = spoken_languages676    @property677    def multi_unit(self):678        """Gets the multi_unit of this PropertyContent.  # noqa: E501679        Boolean value indicating if a property is a multi-unit property.  # noqa: E501680        :return: The multi_unit of this PropertyContent.  # noqa: E501681        :rtype: bool682        """683        return self._multi_unit684    @multi_unit.setter685    def multi_unit(self, multi_unit):686        """Sets the multi_unit of this PropertyContent.687        Boolean value indicating if a property is a multi-unit property.  # noqa: E501688        :param multi_unit: The multi_unit of this PropertyContent.  # noqa: E501689        :type: bool690        """691        self._multi_unit = multi_unit692    def to_dict(self):693        """Returns the model properties as a dict"""694        result = {}695        for attr, _ in six.iteritems(self.swagger_types):696            value = getattr(self, attr)697            if isinstance(value, list):698                result[attr] = list(map(699                    lambda x: x.to_dict() if hasattr(x, "to_dict") else x,700                    value701                ))702            elif hasattr(value, "to_dict"):703                result[attr] = value.to_dict()704            elif isinstance(value, dict):705                result[attr] = dict(map(706                    lambda item: (item[0], item[1].to_dict())707                    if hasattr(item[1], "to_dict") else item,708                    value.items()709                ))710            else:711                result[attr] = value712        if issubclass(PropertyContent, dict):713            for key, value in self.items():714                result[key] = value715        return result716    def to_str(self):717        """Returns the string representation of the model"""718        return pprint.pformat(self.to_dict())719    def __repr__(self):720        """For `print` and `pprint`"""721        return self.to_str()722    def __eq__(self, other):723        """Returns true if both objects are equal"""724        if not isinstance(other, PropertyContent):725            return False726        return self.__dict__ == other.__dict__727    def __ne__(self, other):728        """Returns true if both objects are not equal"""...Object-defineProperty.js
Source:Object-defineProperty.js  
1description("Test to ensure correct behaviour of Object.defineProperty");2shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty({}, 'foo', {value:1}), 'foo'))",3         "JSON.stringify({value: 1, writable: false, enumerable: false, configurable: false})");4shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty({}, 'foo', {}), 'foo'))",5         "JSON.stringify({writable: false, enumerable: false, configurable: false})");6shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty({}, 'foo', {get:undefined}), 'foo'))",7         "JSON.stringify({enumerable: false, configurable: false})");8shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty({}, 'foo', {value:1, writable: false}), 'foo'))",9         "JSON.stringify({value: 1, writable: false, enumerable: false, configurable: false})");10shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty({}, 'foo', {value:1, writable: true}), 'foo'))",11         "JSON.stringify({value: 1, writable: true, enumerable: false, configurable: false})");12shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty({}, 'foo', {value:1, enumerable: false}), 'foo'))",13         "JSON.stringify({value: 1, writable: false, enumerable: false, configurable: false})");14shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty({}, 'foo', {value:1, enumerable: true}), 'foo'))",15         "JSON.stringify({value: 1, writable: false, enumerable: true, configurable: false})");16shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty({}, 'foo', {value:1, configurable: false}), 'foo'))",17         "JSON.stringify({value: 1, writable: false, enumerable: false, configurable: false})");18shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty({}, 'foo', {value:1, configurable: true}), 'foo'))",19         "JSON.stringify({value: 1, writable: false, enumerable: false, configurable: true})");20shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty([1,2,3], 'foo', {value:1, configurable: true}), 'foo'))",21         "JSON.stringify({value: 1, writable: false, enumerable: false, configurable: true})");22shouldBe("Object.getOwnPropertyDescriptor(Object.defineProperty([1,2,3], '1', {value:'foo', configurable: true}), '1').value", "'foo'");23shouldBe("a=[1,2,3], Object.defineProperty(a, '1', {value:'foo', configurable: true}), a[1]", "'foo'");24shouldBe("Object.getOwnPropertyDescriptor(Object.defineProperty([1,2,3], '1', {get:getter, configurable: true}), '1').get", "getter");25shouldThrow("Object.defineProperty([1,2,3], '1', {get:getter, configurable: true})[1]", "'called getter'");26shouldThrow("Object.defineProperty()");27shouldThrow("Object.defineProperty(null)");28shouldThrow("Object.defineProperty('foo')");29shouldThrow("Object.defineProperty({})");30shouldThrow("Object.defineProperty({}, 'foo')");31shouldThrow("Object.defineProperty({}, 'foo', {get:undefined, value:true}).foo");32shouldBeTrue("Object.defineProperty({get foo() { return true; } }, 'foo', {configurable:false}).foo");33function createUnconfigurableProperty(o, prop, writable, enumerable) {34    writable = writable || false;35    enumerable = enumerable || false;36    return Object.defineProperty(o, prop, {value:1, configurable:false, writable: writable, enumerable: enumerable});37}38shouldThrow("Object.defineProperty(createUnconfigurableProperty({}, 'foo'), 'foo', {configurable: true})");39shouldThrow("Object.defineProperty(createUnconfigurableProperty({}, 'foo'), 'foo', {writable: true})");40shouldThrow("Object.defineProperty(createUnconfigurableProperty({}, 'foo'), 'foo', {enumerable: true})");41shouldThrow("Object.defineProperty(createUnconfigurableProperty({}, 'foo', false, true), 'foo', {enumerable: false}), 'foo'");42shouldBe("JSON.stringify(Object.getOwnPropertyDescriptor(Object.defineProperty(createUnconfigurableProperty({}, 'foo', true), 'foo', {writable: false}), 'foo'))",43         "JSON.stringify({value: 1, writable: false, enumerable: false, configurable: false})");44shouldThrow("Object.defineProperty({}, 'foo', {value:1, get: function(){}})");45shouldThrow("Object.defineProperty({}, 'foo', {value:1, set: function(){}})");46shouldThrow("Object.defineProperty({}, 'foo', {writable:true, get: function(){}})");47shouldThrow("Object.defineProperty({}, 'foo', {writable:true, set: function(){}})");48shouldThrow("Object.defineProperty({}, 'foo', {get: null})");49shouldThrow("Object.defineProperty({}, 'foo', {set: null})");50function getter(){ throw "called getter"; }51function getter1(){ throw "called getter1"; }52function setter(){ throw "called setter"; }53function setter1(){ throw "called setter1"; }54shouldThrow("Object.defineProperty({}, 'foo', {set: setter}).foo='test'", "'called setter'");55shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {set: setter}), 'foo', {set: setter1})");56shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {set: setter}), 'foo', {get: getter1})");57shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {set: setter}), 'foo', {value: 1})");58shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {set: setter, configurable: true}), 'foo', {set: setter1}).foo='test'", "'called setter1'");59shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {set: setter, configurable: true}), 'foo', {get: getter1}).foo", "'called getter1'");60shouldBeTrue("Object.defineProperty(Object.defineProperty({}, 'foo', {set: setter, configurable: true}), 'foo', {value: true}).foo");61shouldBeTrue("'foo' in Object.defineProperty(Object.defineProperty({}, 'foo', {set: setter, configurable: true}), 'foo', {writable: true})");62shouldBeUndefined("Object.defineProperty(Object.defineProperty({}, 'foo', {set: setter, configurable: true}), 'foo', {writable: true}).foo");63shouldThrow("Object.defineProperty({}, 'foo', {get: getter}).foo", "'called getter'");64shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {get: getter}), 'foo', {get: getter1})");65shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {get: getter}), 'foo', {set: setter1})");66shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {get: getter, configurable: true}), 'foo', {get: getter1}).foo", "'called getter1'");67shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {get: getter, configurable: true}), 'foo', {set: setter1}).foo='test'", "'called setter1'");68shouldBeTrue("Object.defineProperty(Object.defineProperty({}, 'foo', {get: getter, configurable: true}), 'foo', {value: true}).foo");69shouldBeUndefined("Object.defineProperty(Object.defineProperty({}, 'foo', {get: getter, configurable: true}), 'foo', {writable: true}).foo");70shouldBeTrue("'foo' in Object.defineProperty(Object.defineProperty({}, 'foo', {get: getter, configurable: true}), 'foo', {writable: true})");71shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1}), 'foo', {set: setter1})");72shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1, configurable: true}), 'foo', {set: setter1}).foo='test'", "'called setter1'");73shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1}), 'foo', {get: getter1})");74shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1}), 'foo', {set: setter1})");75shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1, configurable: true}), 'foo', {get: getter1}).foo", "'called getter1'");76shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1, configurable: true}), 'foo', {set: setter1}).foo='test'", "'called setter1'");77// Should be able to redefine an non-writable property, if it is configurable.78shouldBe("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1, configurable: true, writable: false}), 'foo', {value: 2, configurable: true, writable: true}).foo", "2");79shouldBe("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1, configurable: true, writable: false}), 'foo', {value: 2, configurable: true, writable: false}).foo", "2");80// Should be able to redefine an non-writable, non-configurable property, with the same value and attributes.81shouldBe("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1, configurable: false, writable: false}), 'foo', {value: 1, configurable: false, writable: false}).foo", "1");82// Should be able to redefine a configurable accessor, with the same or with different attributes.83// Check the accessor function changed.84shouldBe("Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return 1; }, configurable: true, enumerable: true}), 'foo', {get: function() { return 2; }, configurable: true, enumerable: false}).foo", "2");85shouldBe("Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return 1; }, configurable: true, enumerable: false}), 'foo', {get: function() { return 2; }, configurable: true, enumerable: false}).foo", "2");86// Check the attributes changed.87shouldBeFalse("var result = false; var o = Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return 1; }, configurable: true, enumerable: true}), 'foo', {get: function() { return 2; }, configurable: true, enumerable: false}); for (x in o) result = true; result");88shouldBeTrue("var result = false; var o = Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return 1; }, configurable: true, enumerable: false}), 'foo', {get: function() { return 2; }, configurable: true, enumerable: true}); for (x in o) result = true; result");89// Should be able to define an non-configurable accessor.90shouldBeUndefined("var o = Object.defineProperty({}, 'foo', {get: function() { return 1; }, configurable: true}); delete o.foo; o.foo");91shouldBe("var o = Object.defineProperty({}, 'foo', {get: function() { return 1; }, configurable: false}); delete o.foo; o.foo", '1');92shouldBe("Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return 1; }, configurable: true}), 'foo', {value:2}).foo", "2");93shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return 1; }, configurable: false}), 'foo', {value:2}).foo");94// Defining a data descriptor over an accessor should result in a read only property.95shouldBe("var o = Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return 1; }, configurable: true}), 'foo', {value:2}); o.foo = 3; o.foo", "2");96// Trying to redefine a non-configurable property as configurable should throw.97shouldThrow("Object.defineProperty(Object.defineProperty({}, 'foo', {value: 1}), 'foo', {value:2, configurable: true})");98shouldThrow("Object.defineProperty(Object.defineProperty([], 'foo', {value: 1}), 'foo', {value:2, configurable: true})");99// Test an object with a getter setter.100// Either accessor may be omitted or replaced with undefined, or both may be replaced with undefined.101shouldBe("var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}); o.foo", '42')102shouldBe("var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}); o.foo = 42; o.result;", '42');103shouldBe("var o = Object.defineProperty({}, 'foo', {get:undefined, set:function(x){this.result = x;}}); o.foo", 'undefined')104shouldBe("var o = Object.defineProperty({}, 'foo', {get:undefined, set:function(x){this.result = x;}}); o.foo = 42; o.result;", '42');105shouldBe("var o = Object.defineProperty({}, 'foo', {set:function(x){this.result = x;}}); o.foo", 'undefined')106shouldBe("var o = Object.defineProperty({}, 'foo', {set:function(x){this.result = x;}}); o.foo = 42; o.result;", '42');107shouldBe("var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:undefined}); o.foo", '42')108shouldBe("var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:undefined}); o.foo = 42; o.result;", 'undefined');109shouldBe("var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}}); o.foo", '42')110shouldBe("var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}}); o.foo = 42; o.result;", 'undefined');111shouldBe("var o = Object.defineProperty({}, 'foo', {get:undefined, set:undefined}); o.foo", 'undefined')112shouldBe("var o = Object.defineProperty({}, 'foo', {get:undefined, set:undefined}); o.foo = 42; o.result;", 'undefined');113// Test replacing or removing either the getter or setter individually.114shouldBe("var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:function(){return 13;}}); o.foo", '13')115shouldBe("var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:function(){return 13;}}); o.foo = 42; o.result;", '42')116shouldBe("var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:undefined}); o.foo", 'undefined')117shouldBe("var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:undefined}); o.foo = 42; o.result;", '42')118shouldBe("var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:function(){this.result = 13;}}); o.foo", '42')119shouldBe("var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:function(){this.result = 13;}}); o.foo = 42; o.result;", '13')120shouldBe("var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:undefined}); o.foo", '42')121shouldBe("var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:undefined}); o.foo = 42; o.result;", 'undefined')122// Repeat of the above, in strict mode.123// Either accessor may be omitted or replaced with undefined, or both may be replaced with undefined.124shouldBe("'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}); o.foo", '42')125shouldBe("'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}); o.foo = 42; o.result;", '42');126shouldBe("'use strict'; var o = Object.defineProperty({}, 'foo', {get:undefined, set:function(x){this.result = x;}}); o.foo", 'undefined')127shouldBe("'use strict'; var o = Object.defineProperty({}, 'foo', {get:undefined, set:function(x){this.result = x;}}); o.foo = 42; o.result;", '42');128shouldBe("'use strict'; var o = Object.defineProperty({}, 'foo', {set:function(x){this.result = x;}}); o.foo", 'undefined')129shouldBe("'use strict'; var o = Object.defineProperty({}, 'foo', {set:function(x){this.result = x;}}); o.foo = 42; o.result;", '42');130shouldBe("'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:undefined}); o.foo", '42')131shouldThrow("'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}, set:undefined}); o.foo = 42; o.result;");132shouldBe("'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}}); o.foo", '42')133shouldThrow("'use strict'; var o = Object.defineProperty({}, 'foo', {get:function(){return 42;}}); o.foo = 42; o.result;");134shouldBe("'use strict'; var o = Object.defineProperty({}, 'foo', {get:undefined, set:undefined}); o.foo", 'undefined')135shouldThrow("'use strict'; var o = Object.defineProperty({}, 'foo', {get:undefined, set:undefined}); o.foo = 42; o.result;");136// Test replacing or removing either the getter or setter individually.137shouldBe("'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:function(){return 13;}}); o.foo", '13')138shouldBe("'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:function(){return 13;}}); o.foo = 42; o.result;", '42')139shouldBe("'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:undefined}); o.foo", 'undefined')140shouldBe("'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {get:undefined}); o.foo = 42; o.result;", '42')141shouldBe("'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:function(){this.result = 13;}}); o.foo", '42')142shouldBe("'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:function(){this.result = 13;}}); o.foo = 42; o.result;", '13')143shouldBe("'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:undefined}); o.foo", '42')144shouldThrow("'use strict'; var o = Object.defineProperty(Object.defineProperty({foo:1}, 'foo', {get:function(){return 42;}, set:function(x){this.result = x;}}), 'foo', {set:undefined}); o.foo = 42; o.result;")145Object.defineProperty(Object.prototype, 0, {get:function(){ return false; }, configurable:true})146shouldBeTrue("0 in Object.prototype");147shouldBeTrue("'0' in Object.prototype");148delete Object.prototype[0];149Object.defineProperty(Object.prototype, 'readOnly', {value:true, configurable:true, writable:false})150shouldBeTrue("var o = {}; o.readOnly = false; o.readOnly");151shouldThrow("'use strict'; var o = {}; o.readOnly = false; o.readOnly");152delete Object.prototype.readOnly;153// Check the writable attribute is set correctly when redefining an accessor as a data descriptor.154shouldBeFalse("Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false}), 'foo').writable");155shouldBeFalse("Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: false}), 'foo').writable");156shouldBeTrue("Object.getOwnPropertyDescriptor(Object.defineProperty(Object.defineProperty({}, 'foo', {get: function() { return false; }, configurable: true}), 'foo', {value:false, writable: true}), 'foo').writable");157// If array length is read-only, [[Put]] should fail.158shouldBeFalse("var a = Object.defineProperty([], 'length', {writable: false}); a[0] = 42; 0 in a;");159shouldThrow("'use strict'; var a = Object.defineProperty([], 'length', {writable: false}); a[0] = 42; 0 in a;");160// If array property is read-only, [[Put]] should fail.161shouldBe("var a = Object.defineProperty([42], '0', {writable: false}); a[0] = false; a[0];", '42');162shouldThrow("'use strict'; var a = Object.defineProperty([42], '0', {writable: false}); a[0] = false; a[0];");163// If array property is an undefined setter, [[Put]] should fail.164shouldBeUndefined("var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0];");165shouldThrow("'use strict'; var a = Object.defineProperty([], '0', {set: undefined}); a[0] = 42; a[0];");166function testObject()167{168    // Test case from https://bugs.webkit.org/show_bug.cgi?id=38636169    Object.defineProperty(anObj, 'slot1', {value: 'foo', enumerable: true});170    Object.defineProperty(anObj, 'slot2', {value: 'bar', writable: true}); 171    Object.defineProperty(anObj, 'slot3', {value: 'baz', enumerable: false}); 172    Object.defineProperty(anObj, 'slot4', {value: 'goo', configurable: false}); 173    shouldBe("anObj.slot1", '"foo"');174    shouldBe("anObj.slot2", '"bar"');175    anObj.slot2 = 'bad value';176    shouldBeTrue("anObj.propertyIsEnumerable('slot1')");177    shouldBeFalse("anObj.propertyIsEnumerable('slot2')");178    delete anObj.slot4;179    shouldBe("anObj.slot4", '"goo"');180    // Test case from https://bugs.webkit.org/show_bug.cgi?id=48911181    Object.defineProperty(Object.getPrototypeOf(anObj), 'slot5', {get: function() { return this._Slot5; }, set: function(v) { this._Slot5 = v; }, configurable: false}); 182    anObj.slot5 = 123;183    shouldBe("anObj.slot5", '123');184    shouldBe("anObj._Slot5", '123');185    shouldBeUndefined("Object.getOwnPropertyDescriptor(anObj, 'slot5')");186    Object.defineProperty(anObj, 'slot5', { value: 456 });187    shouldBe("anObj.slot5", '456');188    shouldBe("anObj._Slot5", '123');189    shouldBe("Object.getOwnPropertyDescriptor(anObj, 'slot5').value", '456');190}191var anObj = {};192testObject();193var anObj = this;...test_properties.py
Source:test_properties.py  
...17    def tearDown(self):18        self.part_model.delete()19        super().tearDown()20    def test_create_and_delete_property_model(self):21        new_property = self.client.create_property(22            model=self.part_model,23            name="New property",24            description="Nice prop",25            property_type=PropertyType.CHAR_VALUE,26            default_value="EUREKA!",27        )28        # check whether the property has been created and whether it's name and type are correct29        self.part_model.refresh()30        new_prop = self.part_model.property(name="New property")31        self.assertEqual(new_property, new_prop)32        self.assertIsInstance(new_prop, Property)33        self.assertEqual(new_prop.value, "EUREKA!")34        self.assertEqual(new_prop._json_data["property_type"], PropertyType.CHAR_VALUE)35        # Now delete the property model36        new_property.delete()37        # Retrieve the model again38        self.part_model.refresh()39        # Check whether it still has the property model that has just been deleted40        with self.assertRaises(NotFoundError):41            self.part_model.property("New property")42    def test_create_property_unknown_type(self):43        with self.assertRaises(IllegalArgumentError):44            self.part_model.add_property(45                name="Incorrect property type", property_type="Incorrect property type"46            )47    def test_create_property_on_instance(self):48        with self.assertRaises(IllegalArgumentError):49            self.client.create_property(50                name="Properties are created on models only", model=self.part_instance51            )52    def test_create_property_incorrect_value(self):53        with self.assertRaises(APIError):54            self.part_model.add_property(55                name="Boolean",56                property_type=PropertyType.BOOLEAN_VALUE,57                default_value="Not gonna work",58            )59    # 1.1660    def test_creation_of_all_property_model_types(self):61        # set up62        types = [63            PropertyType.CHAR_VALUE,64            PropertyType.TEXT_VALUE,65            PropertyType.INT_VALUE,66            PropertyType.FLOAT_VALUE,67            PropertyType.BOOLEAN_VALUE,68            PropertyType.DATETIME_VALUE,69            PropertyType.LINK_VALUE,70            PropertyType.DATETIME_VALUE,71            PropertyType.SINGLE_SELECT_VALUE,72            PropertyType.REFERENCES_VALUE,73        ]74        values = [75            "string",76            "text",77            0,78            3.1415,79            False,80            datetime.now().isoformat(sep="T"),81            "https://google.com",82            None,83            None,84            None,85        ]86        for property_type, value in zip(types, values):87            with self.subTest(msg=property_type):88                # setUp89                prop = self.part_model.add_property(90                    name=property_type,91                    property_type=property_type,92                    default_value=value,93                )94                # testing95                if value is not None:96                    self.assertTrue(prop.has_value())97                else:98                    self.assertFalse(prop.has_value())99                # tearDown100                prop.delete()101class TestProperties(TestBetamax):102    def setUp(self):103        super().setUp()104        self.wheel_model = self.project.model("Wheel")105        self.bike_model = self.project.model("Bike")106        self.prop_name = "__Test property"107        self.prop_model = self.bike_model.add_property(108            name=self.prop_name,109            property_type=PropertyType.INT_VALUE,110            description="description of the property",111            unit="unit of the property",112            default_value=42,113        )114        self.bike = self.bike_model.instance()115        self.prop = self.bike.property(name=self.prop_name)116    def tearDown(self):117        if self.prop_model:118            self.prop_model.delete()119        super().tearDown()120    def test_retrieve_properties(self):121        properties = self.project.properties("Diameter")122        self.assertIsInstance(properties, list)123        self.assertTrue(len(properties) > 0)124    def test_retrieve_property(self):125        prop = self.project.property(name="Cheap?", category=Category.MODEL)126        self.assertIsInstance(prop, Property)127        self.assertTrue(prop)128    def test_retrieve_property_model(self):129        model = self.prop.model()130        self.assertEqual(self.prop_model, model)131        models_model = self.prop_model.model()132        self.assertEqual(self.prop_model, models_model)133    def test_property_attributes(self):134        attributes = [135            "_client",136            "_json_data",137            "id",138            "name",139            "created_at",140            "updated_at",141            "ref",142            "output",143            "_value",144            "_options",145            "type",146            "category",147            "_validators",148        ]149        obj = self.project.property(name="Cheap?", category=Category.MODEL)150        for attribute in attributes:151            with self.subTest(msg=attribute):152                self.assertTrue(153                    hasattr(obj, attribute),154                    f"Could not find '{attribute}' in the object: '{obj.__dict__.keys()}'",155                )156    def test_retrieve_properties_with_kwargs(self):157        # setUp158        properties_with_kwargs = self.client.properties(part_id=self.bike.id)159        self.assertTrue(properties_with_kwargs)160        # testing161        for prop in properties_with_kwargs:162            with self.subTest(msg=prop.name):163                self.assertEqual(prop.part.id, self.bike.id)164    def test_get_property_by_name(self):165        gears_property = self.project.properties(name="Gears", category=Category.INSTANCE)[0]166        self.assertEqual(self.bike.property("Gears"), gears_property)167    def test_get_property_by_uuid(self):168        gears_id = self.bike.property("Gears").id169        gears_property = self.project.properties(pk=gears_id, category=Category.INSTANCE)[0]170        self.assertEqual(self.bike.property(gears_id), gears_property)171    def test_get_invalid_property(self):172        with self.assertRaises(NotFoundError):173            self.bike.property("Price")174    def test_set_property(self):175        new_value = self.prop.value * 2176        self.assertNotEqual(new_value, self.prop.value)177        self.prop.value = new_value178        refreshed_prop = self.bike.property(name=self.prop_name)179        self.assertEqual(new_value, self.prop.value)180        self.assertEqual(new_value, self.prop._value)181        self.assertEqual(new_value, self.prop._json_data.get("value"))182        self.assertEqual(self.prop, refreshed_prop)183        self.assertEqual(self.prop.value, refreshed_prop.value)184    def test_part_of_property(self):185        bike2 = self.bike.property("Gears").part186        self.assertEqual(self.bike.id, bike2.id)187    # 1.11188    def test_edit_property_model_name(self):189        # setUp190        new_name = "Cogs"191        self.prop_model.edit(name=new_name)192        reloaded_prop = self.bike_model.property(name=new_name)193        # testing194        self.assertEqual(self.prop_model.id, reloaded_prop.id)195        self.assertEqual(new_name, reloaded_prop.name)196        self.assertEqual(self.prop_model.name, reloaded_prop.name)197        with self.assertRaises(IllegalArgumentError):198            self.prop_model.edit(name=True)199    def test_edit_property_model_description(self):200        # setUp201        new_description = "Cogs, definitely cogs."202        self.prop_model.edit(description=new_description)203        reloaded_prop = self.bike_model.property(name=self.prop_name)204        # testing205        self.assertEqual(self.prop_model.id, reloaded_prop.id)206        self.assertEqual(self.prop_model.description, reloaded_prop.description)207        with self.assertRaises(IllegalArgumentError):208            self.prop_model.edit(description=True)209    def test_edit_property_model_unit(self):210        # setUp211        new_unit = "Totally new units"212        self.prop_model.edit(unit=new_unit)213        reloaded_prop = self.bike_model.property(name=self.prop_name)214        # testing215        self.assertEqual(self.prop_model.id, reloaded_prop.id)216        self.assertEqual(self.prop_model.unit, reloaded_prop.unit)217        with self.assertRaises(IllegalArgumentError):218            self.prop_model.edit(unit=4)219    # test added due to #847 - providing no inputs overwrites values220    def test_edit_property_clear_values(self):221        # setup222        initial_name = "Property first name"223        initial_description = "Property created to test clearing values."224        initial_unit = "mm"225        self.prop_model.edit(name=initial_name, description=initial_description, unit=initial_unit)226        # Edit without mentioning values, everything should stay the same227        new_name = "Property second name"228        self.prop_model.edit(name=new_name)229        # testing230        self.assertEqual(self.prop_model.name, new_name)231        self.assertEqual(self.prop_model.description, initial_description)232        self.assertEqual(self.prop_model.unit, initial_unit),233        # Edit with clearing the values, name and status cannot be cleared234        self.prop_model.edit(name=None, description=None, unit=None)235        self.assertEqual(self.prop_model.name, new_name)236        self.assertEqual(self.prop_model.description, "")237        self.assertEqual(self.prop_model.unit, "")238    # 2.5.4239    def test_property_type(self):240        self.assertEqual(PropertyType.INT_VALUE, str(self.prop_model.type))241    def test_property_unit(self):242        self.assertEqual("unit of the property", str(self.prop_model.unit))243    def test_property_description(self):244        self.assertEqual("description of the property", str(self.prop_model.description))245    # 3.0246    def test_copy_property_model(self):247        # setUp248        copied_property = self.prop_model.copy(249            target_part=self.wheel_model, name="Copied property"250        )251        # testing252        self.assertEqual(copied_property.name, "Copied property")253        self.assertEqual(copied_property.description, self.prop_model.description)254        self.assertEqual(copied_property.unit, self.prop_model.unit)255        self.assertEqual(copied_property.value, self.prop_model.value)256        # tearDown257        copied_property.delete()258    def test_copy_property_instance(self):259        # setUp260        self.prop.value = 200261        copied_property = self.prop.copy(262            target_part=self.project.part(name="Front Wheel"), name="Copied property instance"263        )264        # testing265        self.assertEqual(copied_property.name, "Copied property instance")266        self.assertEqual(copied_property.description, self.prop.description)267        self.assertEqual(copied_property.unit, self.prop.unit)268        self.assertEqual(copied_property.value, self.prop.value)269        # tearDown270        copied_property.model().delete()271    def test_copy_property_instance_to_model(self):272        with self.assertRaises(IllegalArgumentError):273            self.prop.copy(target_part=self.prop_model)274    def test_move_property_model(self):275        # setUp276        moved_property = self.prop_model.move(target_part=self.wheel_model, name="Moved property")277        # testing278        self.assertEqual(moved_property.name, "Moved property")279        self.assertEqual(moved_property.description, self.prop_model.description)280        self.assertEqual(moved_property.unit, self.prop_model.unit)281        self.assertEqual(moved_property.value, self.prop_model.value)282        with self.assertRaises(NotFoundError):283            self.project.property(id=self.prop_model.id)284        # tearDown285        # for a correct teardown in the unittest we need to -reassign- the moved one to the self.test_property_model286        self.prop_model = moved_property287    def test_move_property_instance(self):288        # setUp289        moved_property = self.prop.move(290            target_part=self.wheel_model.instances()[0], name="moved property"291        )292        # testing293        with self.assertRaises(APIError):294            self.project.property(id=self.prop_model.id)295        # tearDown296        # for a correct teardown in the unittest we need to -reassign- the moved one to the self.test_property_model297        self.prop_model = moved_property.model()298    def test_retrieve_properties_with_refs(self):299        # setup300        dual_pad_ref = "dual-pad"301        dual_pad_name = "Dual Pad?"302        dual_pad_property = self.project.property(ref=dual_pad_ref)303        dual_pad_property_model = self.project.property(ref=dual_pad_ref, category=Category.MODEL)304        seat_part = self.project.part(name="Seat")305        dual_pad_prop_retrieved_from_seat = seat_part.property(dual_pad_ref)306        # testing307        self.assertIsInstance(dual_pad_property, Property)308        self.assertEqual(dual_pad_name, dual_pad_property.name)309        self.assertEqual(Category.INSTANCE, dual_pad_property.category)310        self.assertIsInstance(dual_pad_property_model, Property)311        self.assertEqual(dual_pad_name, dual_pad_property_model.name)312        self.assertEqual(Category.MODEL, dual_pad_property_model.category)313        self.assertIsInstance(dual_pad_prop_retrieved_from_seat, Property)314        self.assertEqual(dual_pad_name, dual_pad_prop_retrieved_from_seat.name)315        self.assertEqual(Category.INSTANCE, dual_pad_prop_retrieved_from_seat.category)316        self.assertEqual(dual_pad_property.id, dual_pad_prop_retrieved_from_seat.id)317class TestPropertiesUpdateProperties(TestBetamax):318    def setUp(self):319        super().setUp()320        self.bike = self.project.model("Bike")321        self.submodel = self.project.create_model(name="_test submodel", parent=self.bike)322        self.prop_1 = self.submodel.add_property(323            name=PropertyType.CHAR_VALUE, property_type=PropertyType.CHAR_VALUE324        )325        self.prop_2 = self.submodel.add_property(326            name=PropertyType.TEXT_VALUE, property_type=PropertyType.TEXT_VALUE327        )328        self.props = [self.prop_1, self.prop_2]329    def tearDown(self):330        self.submodel.delete()331        super().tearDown()332    def _refresh_prop(self, p):333        return self.client.property(pk=p.id, category=p.category)334    def test_bulk_update(self):335        """Test the API using the Client method."""336        update = [dict(id=p.id, value="new value") for p in self.props]337        updated_properties = self.client.update_properties(properties=update)338        # testing339        self.assertIsInstance(updated_properties, list)340        self.assertTrue(all(p1 == p2 for p1, p2 in zip(self.props, updated_properties)))341        self.assertTrue(all(isinstance(p, Property) for p in updated_properties))342        self.assertTrue(all(p.value == "new value" for p in updated_properties))343    def test_bulk_update_manual(self):344        """Test storing of value updates in the Property class."""345        # setUp346        Property.set_bulk_update(True)347        self.prop_1.value = "new value"348        self.prop_2.value = "another value"349        # testing350        self.assertIsNone(self._refresh_prop(self.prop_1).value)351        self.assertIsNone(self._refresh_prop(self.prop_2).value)352        Property.update_values(client=self.client)353        self.assertEqual(self._refresh_prop(self.prop_1).value, "new value")354        self.assertEqual(self._refresh_prop(self.prop_2).value, "another value")355    def test_bulk_update_reset(self):356        """Test whether bulk update is reset to `False` after update is performed."""357        # setUp358        Property.set_bulk_update(True)359        self.prop_1.value = "new value"360        # testing361        self.assertIsNone(self._refresh_prop(self.prop_1).value)362        Property.update_values(client=self.client)363        self.assertEqual(self._refresh_prop(self.prop_1).value, "new value")364        self.assertFalse(Property._USE_BULK_UPDATE)365        # setUp 2366        Property.set_bulk_update(True)367        self.prop_2.value = "another value"368        # testing 2369        self.assertIsNone(self._refresh_prop(self.prop_2).value)370        Property.update_values(client=self.client, use_bulk_update=True)371        self.assertEqual(self._refresh_prop(self.prop_2).value, "another value")372        self.assertTrue(Property._USE_BULK_UPDATE)373        # tearDown374        Property.set_bulk_update(False)375class TestPropertiesWithReferenceProperty(TestBetamax):376    def setUp(self):377        super().setUp()378        self.wheel_model = self.project.model("Wheel")379        self.bike = self.project.model("Bike")380        self.test_ref_property_model = self.bike.add_property(381            name=f"__Test ref property @ {datetime.now()}",382            property_type=PropertyType.REFERENCES_VALUE,383            description="Description of test ref property",384            unit="no unit",385            default_value=[self.wheel_model],386        )387        self.test_ref_property_model.validators = [SingleReferenceValidator()]388    def tearDown(self):389        self.test_ref_property_model.delete()390        super().tearDown()391    def test_copy_reference_property_with_options(self):392        # setUp393        copied_ref_property = self.test_ref_property_model.copy(394            target_part=self.wheel_model, name="__Copied ref property"...11.2.1-1.js
Source:11.2.1-1.js  
1/* The contents of this file are subject to the Netscape Public2 * License Version 1.1 (the "License"); you may not use this file3 * except in compliance with the License. You may obtain a copy of4 * the License at http://www.mozilla.org/NPL/5 *6 * Software distributed under the License is distributed on an "AS7 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or8 * implied. See the License for the specific language governing9 * rights and limitations under the License.10 *11 * The Original Code is Mozilla Communicator client code, released March12 * 31, 1998.13 *14 * The Initial Developer of the Original Code is Netscape Communications15 * Corporation. Portions created by Netscape are16 * Copyright (C) 1998 Netscape Communications Corporation. All17 * Rights Reserved.18 *19 * Contributor(s): 20 * 21 */22/**23    File Name:          11.2.1-1.js24    ECMA Section:       11.2.1 Property Accessors25    Description:26    Properties are accessed by name, using either the dot notation:27                                MemberExpression . Identifier28                                CallExpression . Identifier29    or the bracket notation:    MemberExpression [ Expression ]30                                CallExpression [ Expression ]31    The dot notation is explained by the following syntactic conversion:32                                MemberExpression . Identifier33    is identical in its behavior to34                                MemberExpression [ <identifier-string> ]35    and similarly36                                CallExpression . Identifier37    is identical in its behavior to38                                CallExpression [ <identifier-string> ]39    where <identifier-string> is a string literal containing the same sequence40    of characters as the Identifier.41    The production MemberExpression : MemberExpression [ Expression ] is42    evaluated as follows:43    1.  Evaluate MemberExpression.44    2.  Call GetValue(Result(1)).45    3.  Evaluate Expression.46    4.  Call GetValue(Result(3)).47    5.  Call ToObject(Result(2)).48    6.  Call ToString(Result(4)).49    7.  Return a value of type Reference whose base object is Result(5) and50        whose property name is Result(6).51    The production CallExpression : CallExpression [ Expression ] is evaluated52    in exactly the same manner, except that the contained CallExpression is53    evaluated in step 1.54    Author:             christine@netscape.com55    Date:               12 november 199756*/57    var SECTION = "11.2.1-1";58    var VERSION = "ECMA_1";59    startTest();60    var TITLE   = "Property Accessors";61    writeHeaderToLog( SECTION + " "+TITLE );62    var testcases = new Array();63    // go through all Native Function objects, methods, and properties and get their typeof.64    var PROPERTY = new Array();65    var p = 0;66    // properties and functions of the global object67    PROPERTY[p++] = new Property( "this",   "NaN",          "number" );68    PROPERTY[p++] = new Property( "this",   "Infinity",     "number" );69    PROPERTY[p++] = new Property( "this",   "eval",         "function" );70    PROPERTY[p++] = new Property( "this",   "parseInt",     "function" );71    PROPERTY[p++] = new Property( "this",   "parseFloat",   "function" );72    PROPERTY[p++] = new Property( "this",   "escape",       "function" );73    PROPERTY[p++] = new Property( "this",   "unescape",     "function" );74    PROPERTY[p++] = new Property( "this",   "isNaN",        "function" );75    PROPERTY[p++] = new Property( "this",   "isFinite",     "function" );76    PROPERTY[p++] = new Property( "this",   "Object",       "function" );77    PROPERTY[p++] = new Property( "this",   "Number",       "function" );78    PROPERTY[p++] = new Property( "this",   "Function",     "function" );79    PROPERTY[p++] = new Property( "this",   "Array",        "function" );80    PROPERTY[p++] = new Property( "this",   "String",       "function" );81    PROPERTY[p++] = new Property( "this",   "Boolean",      "function" );82    PROPERTY[p++] = new Property( "this",   "Date",         "function" );83    PROPERTY[p++] = new Property( "this",   "Math",         "object" );84    // properties and  methods of Object objects85    PROPERTY[p++] = new Property( "Object", "prototype",    "object" );86    PROPERTY[p++] = new Property( "Object", "toString",     "function" );87    PROPERTY[p++] = new Property( "Object", "valueOf",      "function" );88    PROPERTY[p++] = new Property( "Object", "constructor",  "function" );89    // properties of the Function object90    PROPERTY[p++] = new Property( "Function",   "prototype",    "function" );91    PROPERTY[p++] = new Property( "Function.prototype",   "toString",     "function" );92    PROPERTY[p++] = new Property( "Function.prototype",   "length",       "number" );93    PROPERTY[p++] = new Property( "Function.prototype",   "valueOf",      "function" );94    Function.prototype.myProperty = "hi";95    PROPERTY[p++] = new Property( "Function.prototype",   "myProperty",   "string" );96    // properties of the Array object97    PROPERTY[p++] = new Property( "Array",      "prototype",    "object" );98    PROPERTY[p++] = new Property( "Array",      "length",       "number" );99    PROPERTY[p++] = new Property( "Array.prototype",      "constructor",  "function" );100    PROPERTY[p++] = new Property( "Array.prototype",      "toString",     "function" );101    PROPERTY[p++] = new Property( "Array.prototype",      "join",         "function" );102    PROPERTY[p++] = new Property( "Array.prototype",      "reverse",      "function" );103    PROPERTY[p++] = new Property( "Array.prototype",      "sort",         "function" );104    // properties of the String object105    PROPERTY[p++] = new Property( "String",     "prototype",    "object" );106    PROPERTY[p++] = new Property( "String",     "fromCharCode", "function" );107    PROPERTY[p++] = new Property( "String.prototype",     "toString",     "function" );108    PROPERTY[p++] = new Property( "String.prototype",     "constructor",  "function" );109    PROPERTY[p++] = new Property( "String.prototype",     "valueOf",      "function" );110    PROPERTY[p++] = new Property( "String.prototype",     "charAt",       "function" );111    PROPERTY[p++] = new Property( "String.prototype",     "charCodeAt",   "function" );112    PROPERTY[p++] = new Property( "String.prototype",     "indexOf",      "function" );113    PROPERTY[p++] = new Property( "String.prototype",     "lastIndexOf",  "function" );114    PROPERTY[p++] = new Property( "String.prototype",     "split",        "function" );115    PROPERTY[p++] = new Property( "String.prototype",     "substring",    "function" );116    PROPERTY[p++] = new Property( "String.prototype",     "toLowerCase",  "function" );117    PROPERTY[p++] = new Property( "String.prototype",     "toUpperCase",  "function" );118    PROPERTY[p++] = new Property( "String.prototype",     "length",       "number" );119    // properties of the Boolean object120    PROPERTY[p++] = new Property( "Boolean",    "prototype",    "object" );121    PROPERTY[p++] = new Property( "Boolean",    "constructor",  "function" );122    PROPERTY[p++] = new Property( "Boolean.prototype",    "valueOf",      "function" );123    PROPERTY[p++] = new Property( "Boolean.prototype",    "toString",     "function" );124    // properties of the Number object125    PROPERTY[p++] = new Property( "Number",     "MAX_VALUE",    "number" );126    PROPERTY[p++] = new Property( "Number",     "MIN_VALUE",    "number" );127    PROPERTY[p++] = new Property( "Number",     "NaN",          "number" );128    PROPERTY[p++] = new Property( "Number",     "NEGATIVE_INFINITY",    "number" );129    PROPERTY[p++] = new Property( "Number",     "POSITIVE_INFINITY",    "number" );130    PROPERTY[p++] = new Property( "Number.prototype",     "toString",     "function" );131    PROPERTY[p++] = new Property( "Number.prototype",     "constructor",  "function" );132    PROPERTY[p++] = new Property( "Number.prototype",     "valueOf",        "function" );133    // properties of the Math Object.134    PROPERTY[p++] = new Property( "Math",   "E",        "number" );135    PROPERTY[p++] = new Property( "Math",   "LN10",     "number" );136    PROPERTY[p++] = new Property( "Math",   "LN2",      "number" );137    PROPERTY[p++] = new Property( "Math",   "LOG2E",    "number" );138    PROPERTY[p++] = new Property( "Math",   "LOG10E",   "number" );139    PROPERTY[p++] = new Property( "Math",   "PI",       "number" );140    PROPERTY[p++] = new Property( "Math",   "SQRT1_2",  "number" );141    PROPERTY[p++] = new Property( "Math",   "SQRT2",    "number" );142    PROPERTY[p++] = new Property( "Math",   "abs",      "function" );143    PROPERTY[p++] = new Property( "Math",   "acos",     "function" );144    PROPERTY[p++] = new Property( "Math",   "asin",     "function" );145    PROPERTY[p++] = new Property( "Math",   "atan",     "function" );146    PROPERTY[p++] = new Property( "Math",   "atan2",    "function" );147    PROPERTY[p++] = new Property( "Math",   "ceil",     "function" );148    PROPERTY[p++] = new Property( "Math",   "cos",      "function" );149    PROPERTY[p++] = new Property( "Math",   "exp",      "function" );150    PROPERTY[p++] = new Property( "Math",   "floor",    "function" );151    PROPERTY[p++] = new Property( "Math",   "log",      "function" );152    PROPERTY[p++] = new Property( "Math",   "max",      "function" );153    PROPERTY[p++] = new Property( "Math",   "min",      "function" );154    PROPERTY[p++] = new Property( "Math",   "pow",      "function" );155    PROPERTY[p++] = new Property( "Math",   "random",   "function" );156    PROPERTY[p++] = new Property( "Math",   "round",    "function" );157    PROPERTY[p++] = new Property( "Math",   "sin",      "function" );158    PROPERTY[p++] = new Property( "Math",   "sqrt",     "function" );159    PROPERTY[p++] = new Property( "Math",   "tan",      "function" );160    // properties of the Date object161    PROPERTY[p++] = new Property( "Date",   "parse",        "function" );162    PROPERTY[p++] = new Property( "Date",   "prototype",    "object" );163    PROPERTY[p++] = new Property( "Date",   "UTC",          "function" );164    PROPERTY[p++] = new Property( "Date.prototype",   "constructor",    "function" );165    PROPERTY[p++] = new Property( "Date.prototype",   "toString",       "function" );166    PROPERTY[p++] = new Property( "Date.prototype",   "valueOf",        "function" );167    PROPERTY[p++] = new Property( "Date.prototype",   "getTime",        "function" );168    PROPERTY[p++] = new Property( "Date.prototype",   "getYear",        "function" );169    PROPERTY[p++] = new Property( "Date.prototype",   "getFullYear",    "function" );170    PROPERTY[p++] = new Property( "Date.prototype",   "getUTCFullYear", "function" );171    PROPERTY[p++] = new Property( "Date.prototype",   "getMonth",       "function" );172    PROPERTY[p++] = new Property( "Date.prototype",   "getUTCMonth",    "function" );173    PROPERTY[p++] = new Property( "Date.prototype",   "getDate",        "function" );174    PROPERTY[p++] = new Property( "Date.prototype",   "getUTCDate",     "function" );175    PROPERTY[p++] = new Property( "Date.prototype",   "getDay",         "function" );176    PROPERTY[p++] = new Property( "Date.prototype",   "getUTCDay",      "function" );177    PROPERTY[p++] = new Property( "Date.prototype",   "getHours",       "function" );178    PROPERTY[p++] = new Property( "Date.prototype",   "getUTCHours",    "function" );179    PROPERTY[p++] = new Property( "Date.prototype",   "getMinutes",     "function" );180    PROPERTY[p++] = new Property( "Date.prototype",   "getUTCMinutes",  "function" );181    PROPERTY[p++] = new Property( "Date.prototype",   "getSeconds",     "function" );182    PROPERTY[p++] = new Property( "Date.prototype",   "getUTCSeconds",  "function" );183    PROPERTY[p++] = new Property( "Date.prototype",   "getMilliseconds","function" );184    PROPERTY[p++] = new Property( "Date.prototype",   "getUTCMilliseconds", "function" );185    PROPERTY[p++] = new Property( "Date.prototype",   "setTime",        "function" );186    PROPERTY[p++] = new Property( "Date.prototype",   "setMilliseconds","function" );187    PROPERTY[p++] = new Property( "Date.prototype",   "setUTCMilliseconds", "function" );188    PROPERTY[p++] = new Property( "Date.prototype",   "setSeconds",     "function" );189    PROPERTY[p++] = new Property( "Date.prototype",   "setUTCSeconds",  "function" );190    PROPERTY[p++] = new Property( "Date.prototype",   "setMinutes",     "function" );191    PROPERTY[p++] = new Property( "Date.prototype",   "setUTCMinutes",  "function" );192    PROPERTY[p++] = new Property( "Date.prototype",   "setHours",       "function" );193    PROPERTY[p++] = new Property( "Date.prototype",   "setUTCHours",    "function" );194    PROPERTY[p++] = new Property( "Date.prototype",   "setDate",        "function" );195    PROPERTY[p++] = new Property( "Date.prototype",   "setUTCDate",     "function" );196    PROPERTY[p++] = new Property( "Date.prototype",   "setMonth",       "function" );197    PROPERTY[p++] = new Property( "Date.prototype",   "setUTCMonth",    "function" );198    PROPERTY[p++] = new Property( "Date.prototype",   "setFullYear",    "function" );199    PROPERTY[p++] = new Property( "Date.prototype",   "setUTCFullYear", "function" );200    PROPERTY[p++] = new Property( "Date.prototype",   "setYear",        "function" );201    PROPERTY[p++] = new Property( "Date.prototype",   "toLocaleString", "function" );202    PROPERTY[p++] = new Property( "Date.prototype",   "toUTCString",    "function" );203    PROPERTY[p++] = new Property( "Date.prototype",   "toGMTString",    "function" );204    for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {205        RESULT = eval("typeof " + PROPERTY[i].object + "." + PROPERTY[i].name );206        testcases[tc++] = new TestCase( SECTION,207                                        "typeof " + PROPERTY[i].object + "." + PROPERTY[i].name,208                                        PROPERTY[i].type,209                                        RESULT );210        RESULT = eval("typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']");211        testcases[tc++] = new TestCase( SECTION,212                                        "typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']",213                                        PROPERTY[i].type,214                                        RESULT );215    }216    test();217function test() {218    for ( tc=0; tc < testcases.length; tc++ ) {219        testcases[tc].passed = writeTestCaseResult(220                            testcases[tc].expect,221                            testcases[tc].actual,222                            testcases[tc].description +" = "+223                            testcases[tc].actual );224        testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";225    }226    stopTest();227    return ( testcases );228}229function MyObject( arg0, arg1, arg2, arg3, arg4 ) {230    this.name   = arg0;231}232function Property( object, name, type ) {233    this.object = object;234    this.name = name;235    this.type = type;...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!!
