Best JavaScript code snippet using fast-check-monorepo
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
...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()...
11.2.1-1.js
Source:11.2.1-1.js
...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;...
GridMaterialPropertySpec.js
Source:GridMaterialPropertySpec.js
...18 TimeIntervalCollectionProperty) {19 'use strict';2021 it('constructor provides the expected defaults', function() {22 var property = new GridMaterialProperty();23 expect(property.color).toBeUndefined();24 expect(property.cellAlpha).toBeUndefined();25 expect(property.lineCount).toBeUndefined();26 expect(property.lineThickness).toBeUndefined();27 expect(property.lineOffset).toBeUndefined();2829 expect(property.getType()).toEqual('Grid');3031 var result = property.getValue();32 expect(result.color).toEqual(Color.WHITE);33 expect(result.cellAlpha).toEqual(0.1);34 expect(result.lineCount).toEqual(new Cartesian2(8, 8));35 expect(result.lineThickness).toEqual(new Cartesian2(1.0, 1.0));36 expect(result.lineOffset).toEqual(new Cartesian2(0.0, 0.0));37 });3839 it('constructor sets options and allows raw assignment', function() {40 var options = {41 color : Color.RED,42 cellAlpha : 1,43 lineCount : new Cartesian2(2, 3),44 lineThickness : new Cartesian2(4, 5),45 lineOffset : new Cartesian2(6, 7)46 };4748 var property = new GridMaterialProperty(options);49 expect(property.color).toBeInstanceOf(ConstantProperty);50 expect(property.cellAlpha).toBeInstanceOf(ConstantProperty);51 expect(property.lineCount).toBeInstanceOf(ConstantProperty);52 expect(property.lineThickness).toBeInstanceOf(ConstantProperty);53 expect(property.lineOffset).toBeInstanceOf(ConstantProperty);5455 expect(property.color.getValue()).toEqual(options.color);56 expect(property.cellAlpha.getValue()).toEqual(options.cellAlpha);57 expect(property.lineCount.getValue()).toEqual(options.lineCount);58 expect(property.lineThickness.getValue()).toEqual(options.lineThickness);59 expect(property.lineOffset.getValue()).toEqual(options.lineOffset);60 });6162 it('works with constant values', function() {63 var property = new GridMaterialProperty();64 property.color = new ConstantProperty(Color.RED);65 property.cellAlpha = new ConstantProperty(1.0);66 property.lineCount = new ConstantProperty(new Cartesian2(3.4, 5.0));67 property.lineThickness = new ConstantProperty(new Cartesian2(2, 3));68 property.lineOffset = new ConstantProperty(new Cartesian2(0.7, 0.8));6970 var result = property.getValue(JulianDate.now());71 expect(result.color).toEqual(Color.RED);72 expect(result.cellAlpha).toEqual(1);73 expect(result.lineCount).toEqual(new Cartesian2(3.4, 5.0));74 expect(result.lineThickness).toEqual(new Cartesian2(2, 3));75 expect(result.lineOffset).toEqual(new Cartesian2(0.7, 0.8));76 });7778 it('works with dynamic values', function() {79 var property = new GridMaterialProperty();80 property.color = new TimeIntervalCollectionProperty();81 property.cellAlpha = new TimeIntervalCollectionProperty();82 property.lineCount = new TimeIntervalCollectionProperty();83 property.lineThickness = new TimeIntervalCollectionProperty();84 property.lineOffset = new TimeIntervalCollectionProperty();8586 var start = new JulianDate(1, 0);87 var stop = new JulianDate(2, 0);88 property.color.intervals.addInterval(new TimeInterval({89 start : start,90 stop : stop,91 data : Color.BLUE92 }));93 property.cellAlpha.intervals.addInterval(new TimeInterval({94 start : start,95 stop : stop,96 data : 1.097 }));98 property.lineCount.intervals.addInterval(new TimeInterval({99 start : start,100 stop : stop,101 data : new Cartesian2(3.4, 5.0)102 }));103 property.lineThickness.intervals.addInterval(new TimeInterval({104 start : start,105 stop : stop,106 data : new Cartesian2(2, 3)107 }));108 property.lineOffset.intervals.addInterval(new TimeInterval({109 start : start,110 stop : stop,111 data : new Cartesian2(0.7, 0.8)112 }));113114 var result = property.getValue(start);115 expect(result.color).toEqual(Color.BLUE);116 expect(result.cellAlpha).toEqual(1);117 expect(result.lineCount).toEqual(new Cartesian2(3.4, 5.0));118 expect(result.lineThickness).toEqual(new Cartesian2(2, 3));119 expect(result.lineOffset).toEqual(new Cartesian2(0.7, 0.8));120 });121122 it('works with a result parameter', function() {123 var property = new GridMaterialProperty();124 property.color = new ConstantProperty(Color.RED);125 property.cellAlpha = new ConstantProperty(1.0);126 property.lineCount = new ConstantProperty(new Cartesian2(3.4, 5.0));127 property.lineThickness = new ConstantProperty(new Cartesian2(2, 3));128 property.lineOffset = new ConstantProperty(new Cartesian2(0.7, 0.8));129130 var result = {};131 var returnedResult = property.getValue(JulianDate.now(), result);132 expect(result).toBe(returnedResult);133 expect(result.color).toEqual(Color.RED);134 expect(result.cellAlpha).toEqual(1.0);135 expect(result.lineCount).toEqual(new Cartesian2(3.4, 5.0));136 expect(result.lineThickness).toEqual(new Cartesian2(2, 3));137 expect(result.lineOffset).toEqual(new Cartesian2(0.7, 0.8));138 });139140 it('equals works', function() {141 var left = new GridMaterialProperty();142 left.color = new ConstantProperty(Color.RED);143 left.cellAlpha = new ConstantProperty(1.0);144 left.lineCount = new ConstantProperty(new Cartesian2(3.4, 5.0));145 left.lineThickness = new ConstantProperty(new Cartesian2(2, 3));146 left.lineOffset = new ConstantProperty(new Cartesian2(0.7, 0.8));147148 var right = new GridMaterialProperty();149 right.color = new ConstantProperty(Color.RED);150 right.cellAlpha = new ConstantProperty(1.0);151 right.lineCount = new ConstantProperty(new Cartesian2(3.4, 5.0));152 right.lineThickness = new ConstantProperty(new Cartesian2(2, 3));153 right.lineOffset = new ConstantProperty(new Cartesian2(0.7, 0.8));154155 expect(left.equals(right)).toEqual(true);156157 right.color = new ConstantProperty(Color.BLUE);158 expect(left.equals(right)).toEqual(false);159160 right.color = left.color;161 right.cellAlpha = new ConstantProperty(0.5);162 expect(left.equals(right)).toEqual(false);163164 right.cellAlpha = left.cellAlpha;165 right.lineCount = new ConstantProperty(new Cartesian2(4, 5.0));166 expect(left.equals(right)).toEqual(false);167168 right.lineCount = left.lineCount;169 right.lineThickness = new ConstantProperty(new Cartesian2(3, 2));170 expect(left.equals(right)).toEqual(false);171172 right.lineThickness = left.lineThickness;173 right.lineOffset = new ConstantProperty(new Cartesian2(0.8, 0.7));174 expect(left.equals(right)).toEqual(false);175176 right.lineOffset = left.lineOffset;177 expect(left.equals(right)).toEqual(true);178 });179180 it('raises definitionChanged when a property is assigned or modified', function() {181 var property = new GridMaterialProperty();182 var listener = jasmine.createSpy('listener');183 property.definitionChanged.addEventListener(listener);184185 var oldValue = property.color;186 property.color = new ConstantProperty(Color.WHITE);187 expect(listener).toHaveBeenCalledWith(property, 'color', property.color, oldValue);188 listener.calls.reset();189190 property.color.setValue(Color.BLACK);191 expect(listener).toHaveBeenCalledWith(property, 'color', property.color, property.color);192 listener.calls.reset();193194 property.color = property.color;195 expect(listener.calls.count()).toEqual(0);196 listener.calls.reset();197198 oldValue = property.cellAlpha;199 property.cellAlpha = new ConstantProperty(0.0);200 expect(listener).toHaveBeenCalledWith(property, 'cellAlpha', property.cellAlpha, oldValue);201 listener.calls.reset();202203 property.cellAlpha.setValue(1.0);204 expect(listener).toHaveBeenCalledWith(property, 'cellAlpha', property.cellAlpha, property.cellAlpha);205 listener.calls.reset();206207 property.cellAlpha = property.cellAlpha;208 expect(listener.calls.count()).toEqual(0);209 listener.calls.reset();210211 oldValue = property.lineCount;212 property.lineCount = new ConstantProperty(5.0);213 expect(listener).toHaveBeenCalledWith(property, 'lineCount', property.lineCount, oldValue);214 listener.calls.reset();215216 property.lineCount.setValue(10.0);217 expect(listener).toHaveBeenCalledWith(property, 'lineCount', property.lineCount, property.lineCount);218 listener.calls.reset();219220 property.lineCount = property.lineCount;221 expect(listener.calls.count()).toEqual(0);222 listener.calls.reset();223224 oldValue = property.lineThickness;225 property.lineThickness = new ConstantProperty(5.0);226 expect(listener).toHaveBeenCalledWith(property, 'lineThickness', property.lineThickness, oldValue);227 listener.calls.reset();228229 property.lineThickness.setValue(10.0);230 expect(listener).toHaveBeenCalledWith(property, 'lineThickness', property.lineThickness, property.lineThickness);231 listener.calls.reset();232233 oldValue = property.lineOffset;234 property.lineOffset = new ConstantProperty(5.0);235 expect(listener).toHaveBeenCalledWith(property, 'lineOffset', property.lineOffset, oldValue);236 listener.calls.reset();237238 property.lineOffset.setValue(10.0);239 expect(listener).toHaveBeenCalledWith(property, 'lineOffset', property.lineOffset, property.lineOffset);240 listener.calls.reset();241242 property.lineOffset = property.lineOffset;243 expect(listener.calls.count()).toEqual(0);244 });245246 it('isConstant is only true when all properties are constant or undefined', function() {247 var property = new GridMaterialProperty();248 expect(property.isConstant).toBe(true);249250 property.color = undefined;251 property.cellAlpha = undefined;252 property.lineCount = undefined;253 property.lineThickness = undefined;254 property.lineOffset = undefined;255 expect(property.isConstant).toBe(true);256257 property.color = new SampledProperty(Color);258 property.color.addSample(JulianDate.now(), Color.WHITE);259 expect(property.isConstant).toBe(false);260261 property.color = undefined;262 expect(property.isConstant).toBe(true);263 property.cellAlpha = new SampledProperty(Number);264 property.cellAlpha.addSample(JulianDate.now(), 0);265 expect(property.isConstant).toBe(false);266267 property.cellAlpha = undefined;268 expect(property.isConstant).toBe(true);269 property.lineCount = new SampledProperty(Number);270 property.lineCount.addSample(JulianDate.now(), 1);271 expect(property.isConstant).toBe(false);272273 property.lineCount = undefined;274 expect(property.isConstant).toBe(true);275 property.lineThickness = new SampledProperty(Number);276 property.lineThickness.addSample(JulianDate.now(), 1);277 expect(property.isConstant).toBe(false);278279 property.lineThickness = undefined;280 expect(property.isConstant).toBe(true);281 property.lineOffset = new SampledProperty(Number);282 property.lineOffset.addSample(JulianDate.now(), 1);283 expect(property.isConstant).toBe(false);284 });
...
PropertyBagSpec.js
Source:PropertyBagSpec.js
...19 });2021 it('sets correct values when constructed with arguments', function() {22 var property = new PropertyBag({23 a : new ConstantProperty(1),24 b : new ConstantProperty(2)25 });2627 expect(property.propertyNames).toContain('a');28 expect(property.a).toBeDefined();29 expect(property.a).toBeInstanceOf(ConstantProperty);30 expect(property.hasProperty('a')).toEqual(true);3132 expect(property.propertyNames).toContain('b');33 expect(property.b).toBeDefined();34 expect(property.b).toBeInstanceOf(ConstantProperty);35 expect(property.hasProperty('b')).toEqual(true);3637 expect(property.getValue(time)).toEqual({38 a : 1,39 b : 240 });41 });4243 it('works with result parameter', function() {44 var property = new PropertyBag({45 a : new ConstantProperty(1),46 b : new ConstantProperty(2)47 });4849 var expectedResult = {50 a : -151 };52 var result = property.getValue(time, expectedResult);53 expect(result).toEqual({54 a : 1,55 b : 256 });57 expect(result).toBe(expectedResult);58 });5960 it('leaves extra properties in result object in place', function() {61 var property = new PropertyBag({62 a : new ConstantProperty(1)63 });6465 var expectedResult = {66 q : -167 };68 var result = property.getValue(time, expectedResult);69 expect(result).toEqual({70 a : 1,71 q : -172 });73 expect(result).toBe(expectedResult);74 });7576 it('converts raw values to properties when constructed', function() {77 var property = new PropertyBag({78 a : 1,79 b : 280 });8182 expect(property.propertyNames).toContain('a');83 expect(property.a).toBeInstanceOf(ConstantProperty);8485 expect(property.propertyNames).toContain('b');86 expect(property.b).toBeInstanceOf(ConstantProperty);8788 expect(property.getValue(time)).toEqual({89 a : 1,90 b : 291 });92 });9394 function FakeProperty(v) {95 this.v = v;96 }97 FakeProperty.prototype.getValue = function() {98 return this.v;99 };100 function createFakeProperty(v) {101 return new FakeProperty(v);102 }103104 it('uses the provided function to convert raw values to properties when constructed', function() {105 var property = new PropertyBag({106 a : 1,107 b : 2108 }, createFakeProperty);109110 expect(property.propertyNames).toContain('a');111 expect(property.a).toBeDefined();112 expect(property.a).toBeInstanceOf(FakeProperty);113114 expect(property.propertyNames).toContain('b');115 expect(property.b).toBeDefined();116 expect(property.b).toBeInstanceOf(FakeProperty);117118 expect(property.getValue(time)).toEqual({119 a : 1,120 b : 2121 });122 });123124 it('returns correct results from hasProperty', function() {125 var property = new PropertyBag();126 expect(property.hasProperty('a')).toEqual(false);127 property.addProperty('a');128 expect(property.hasProperty('a')).toEqual(true);129 });130131 it('allows adding a property without a value', function() {132 var property = new PropertyBag();133 property.addProperty('a');134135 expect(property.propertyNames).toEqual(['a']);136 expect(property.a).toBeUndefined();137 expect(property.hasProperty('a')).toEqual(true);138139 expect(property.getValue(time)).toEqual({140 a : undefined141 });142 });143144 it('allows adding a property with a value', function() {145 var property = new PropertyBag();146 property.addProperty('a', new ConstantProperty(1));147148 expect(property.propertyNames).toEqual(['a']);149 expect(property.a).toBeInstanceOf(ConstantProperty);150151 expect(property.getValue(time)).toEqual({152 a : 1153 });154 });155156 it('uses the provided function to convert raw values to properties when added with a value', function() {157 var property = new PropertyBag();158 property.addProperty('a', 1, createFakeProperty);159160 expect(property.propertyNames).toEqual(['a']);161 expect(property.a).toBeInstanceOf(FakeProperty);162163 expect(property.getValue(time)).toEqual({164 a : 1165 });166 });167168 it('uses the provided function to convert raw values to properties when added without a value', function() {169 var property = new PropertyBag();170 property.addProperty('a', undefined, createFakeProperty);171172 expect(property.propertyNames).toEqual(['a']);173 expect(property.a).toBeUndefined();174175 property.a = 1;176 expect(property.a).toBeInstanceOf(FakeProperty);177178 expect(property.getValue(time)).toEqual({179 a : 1180 });181 });182183 it('allows removing a property that was previously added', function() {184 var property = new PropertyBag();185186 property.addProperty('a', new ConstantProperty(1));187 expect(property.hasProperty('a')).toEqual(true);188189 property.removeProperty('a');190191 expect(property.propertyNames).toEqual([]);192 expect(property.a).toBeUndefined();193 expect(property.hasProperty('a')).toEqual(false);194195 expect(property.getValue(time)).toEqual({});196 });197198 it('throws when removing a property that was not added', function() {199 var property = new PropertyBag();200 expect(function() {201 property.removeProperty('a');202 }).toThrowDeveloperError();203 });204205 it('raises definitionChanged event when addProperty is called', function() {206 var property = new PropertyBag();207 var listener = jasmine.createSpy('listener');208 property.definitionChanged.addEventListener(listener);209 property.addProperty('a');210 expect(listener).toHaveBeenCalledWith(property);211 });212213 it('raises definitionChanged event when properties are changed', function() {214 var property = new PropertyBag();215 property.addProperty('a');216217 var listener = jasmine.createSpy('listener');218 property.definitionChanged.addEventListener(listener);219220 var a = new ConstantProperty(1);221 property.a = a;222223 expect(listener).toHaveBeenCalledWith(property, 'a', a, undefined);224 });225226 it('requires propertyName in addProperty', function() {227 var property = new PropertyBag();228 expect(function() {229 property.addProperty();230 }).toThrowDeveloperError();231 });232233 it('requires propertyName in removeProperty', function() {234 var property = new PropertyBag();235 expect(function() {236 property.removeProperty();237 }).toThrowDeveloperError();238 });239240 it('has working equals function', function() {241 var left = new PropertyBag({242 a : new ConstantProperty(1)243 });244 var right = new PropertyBag({245 a : new ConstantProperty(1)246 });247248 expect(left.equals(right)).toEqual(true);249250 right.addProperty('c');251 expect(left.equals(right)).toEqual(false);252253 right = new PropertyBag({254 a : new ConstantProperty(2)255 });256 expect(left.equals(right)).toEqual(false);257258 right = new PropertyBag({259 b : new ConstantProperty(1)260 });261 expect(left.equals(right)).toEqual(false);262263 right = new PropertyBag();264 expect(left.equals(right)).toEqual(false);265266 left = new PropertyBag();267 right = new PropertyBag();268 expect(left.equals(right)).toEqual(true);269 });270271 it('returns true from isConstant only if all members are constant', function() {272 var property = new PropertyBag();273274 property.addProperty('a', new ConstantProperty(2));275 expect(property.isConstant).toBe(true);276277 var sampledProperty = new SampledProperty(Number);278 sampledProperty.addSample(time, 1);279 property.addProperty('b', sampledProperty);280281 expect(property.isConstant).toBe(false);282 });
...
array-defineOwnProperty.js
Source:array-defineOwnProperty.js
1description("This test checks the behavior of [[DefineOwnProperty]] applied to Array objects (see ES5.1 15.4.5.1).");2// Test that properties other than length, array indices are handled as normal.3shouldBeTrue("Object.defineProperty([], 'x', { get:function(){return true;} }).x");4// The length property can be set, and can be made read-only.5shouldBe("Object.defineProperty([], 'length', { value: 1 }).length", '1');6shouldBe("var a = Object.defineProperty([], 'length', { writable: false }); a[1] = 1; a.length", '0');7shouldBe("var a = Object.defineProperty([], 'length', { writable: false }); a.length = 1; a.length", '0');8// If writable is not specified, it should not change.9shouldBe("var a = Object.defineProperty([], 'length', {}); a.length = 1; a.length", '1');10// The length property can be replaced with an accessor, or made either enumerable or configurable.11shouldThrow("Object.defineProperty([], 'length', { get:function(){return true;} })");12shouldThrow("Object.defineProperty([], 'length', { enumerable: true })");13shouldThrow("Object.defineProperty([], 'length', { configurable: true })");14shouldThrow("Object.defineProperty(Object.defineProperty([], 'length', { writable: false }), 'length', { writable: true })");15// The value of an indexed property can be set.16shouldBe("var a = Object.defineProperty([], '0', { value: 42 }); a[0]", '42');17// An indexed property can be made non-writable/enumerable/configurable.18shouldBe("var a = Object.defineProperty([42], '0', { writable: false }); a[0] = 1; a[0]", '42');19shouldBe("var a = Object.defineProperty([42], '0', { enumerable: false }); a[0] + Object.keys(a).length", '42');20shouldBe("var a = Object.defineProperty([42], '0', { configurable: false }); a.length = 0; a[0]", '42');21// An indexed property can be defined as an accessor.22shouldBe("var foo = 0; Object.defineProperty([], '0', { set:function(x){foo = x;} })[0] = 42; foo", '42');23shouldBeTrue("Object.defineProperty([], '0', { get:function(){return true;} })[0]")24// A configurable, non-writable property can be made writable, but a non-configurable one cannot.25shouldBeTrue("Object.defineProperty(Object.defineProperty([true], '0', { configurable:true, writable: false }), '0', { writable: true })[0]");26shouldThrow("Object.defineProperty(Object.defineProperty([true], '0', { configurable:false, writable: false }), '0', { writable: true })[0]");27// Reassigning the value is okay if the property is writable.28shouldBe("Object.defineProperty(Object.defineProperty([], '0', { value: 1, writable:true }), '0', { value: 2 })[0]", '2');29// Reassigning the value is okay if the value doesn't change.30shouldBe("Object.defineProperty(Object.defineProperty([], '0', { value: 1 }), '0', { value: 1 })[0]", '1');31shouldBe("Object.defineProperty(Object.defineProperty([], '0', { value: Number.NaN }), '0', { value: -Number.NaN })[0]", 'Number.NaN');32shouldBe("Object.defineProperty(Object.defineProperty([], '0', { value: 'okay'.substring(0,2) }), '0', { value: 'not ok'.substring(4,6) })[0]", '"ok"');33shouldBe("Object.defineProperty(Object.defineProperty([], '0', { value: true }), '0', { value: true })[0]", 'true');34shouldBe("Object.defineProperty(Object.defineProperty([], '0', { value: false }), '0', { value: false })[0]", 'false');35shouldBe("Object.defineProperty(Object.defineProperty([], '0', { value: null }), '0', { value: null })[0]", 'null');36shouldBe("Object.defineProperty(Object.defineProperty([], '0', { value: undefined }), '0', { value: undefined })[0]", 'undefined');37shouldBe("Object.defineProperty(Object.defineProperty([], '0', { value: Math }), '0', { value: Math })[0]", 'Math');38// Reassigning the value is not okay if the value changes.39shouldThrow("Object.defineProperty(Object.defineProperty([], '0', { value: 1 }), '0', { value: 2 })[0]");40shouldThrow("Object.defineProperty(Object.defineProperty([], '0', { value: 'okay' }), '0', { value: 'not ok' })[0]");41shouldThrow("Object.defineProperty(Object.defineProperty([], '0', { value: true }), '0', { value: false })[0]");42shouldThrow("Object.defineProperty(Object.defineProperty([], '0', { value: false }), '0', { value: true })[0]");43shouldThrow("Object.defineProperty(Object.defineProperty([], '0', { value: Math }), '0', { value: Object })[0]");44// Reassigning the value is not okay if the type changes.45shouldThrow("Object.defineProperty(Object.defineProperty([], '0', { value: null }), '0', { value: undefined })[0]");46shouldThrow("Object.defineProperty(Object.defineProperty([], '0', { value: undefined }), '0', { value: null })[0]");...
__init__.py
Source:__init__.py
1"""All pykechain surrogate models based on KE-chain models."""2from typing import Union3from .base import Base, BaseInScope4from .notification import Notification5from .scope import Scope6from .scope2 import Scope27from .activity import Activity8from .activity2 import Activity29from .association import Association10from .part import Part11from .part2 import Part212from .property import Property13from .property_attachment import AttachmentProperty14from .property_selectlist import SelectListProperty, MultiSelectListProperty15from .property_multi_reference import MultiReferenceProperty16from .property_datetime import DatetimeProperty17from .property2 import Property218from .property2_attachment import AttachmentProperty219from .property2_selectlist import SelectListProperty220from .property2_multi_reference import MultiReferenceProperty221from .property2_datetime import DatetimeProperty222from .property_reference import (23 ActivityReferencesProperty,24 ContextReferencesProperty,25 ScopeReferencesProperty,26 StatusReferencesProperty,27 UserReferencesProperty,28 FormReferencesProperty,29)30from .partset import PartSet31from .service import Service, ServiceExecution32from .team import Team33from .user import User34from .value_filter import PropertyValueFilter35from ..enums import PropertyType36AnyProperty = Union[37 "Property",38 "MultiReferenceProperty",39 "AttachmentProperty",40 "SelectListProperty",41 "DatetimeProperty",42 "Property2",43 "MultiReferenceProperty2",44 "AttachmentProperty2",45 "SelectListProperty2",46 "DatetimeProperty2",47 "ActivityReferencesProperty",48 "ScopeReferencesProperty",49 "UserReferencesProperty",50 "FormReferencesProperty",51 "ContextReferencesProperty",52 "StatusReferencesProperty",53]54# This map is used to identify the correct class for the (KE-chain provided) property type.55property_type_to_class_map = {56 PropertyType.ATTACHMENT_VALUE: AttachmentProperty,57 PropertyType.SINGLE_SELECT_VALUE: SelectListProperty,58 PropertyType.MULTI_SELECT_VALUE: MultiSelectListProperty,59 PropertyType.REFERENCES_VALUE: MultiReferenceProperty,60 PropertyType.DATETIME_VALUE: DatetimeProperty,61 PropertyType.ACTIVITY_REFERENCES_VALUE: ActivityReferencesProperty,62 PropertyType.SCOPE_REFERENCES_VALUE: ScopeReferencesProperty,63 PropertyType.USER_REFERENCES_VALUE: UserReferencesProperty,64 PropertyType.FORM_REFERENCES_VALUE: FormReferencesProperty,65 PropertyType.CONTEXT_REFERENCES_VALUE: ContextReferencesProperty,66 PropertyType.STATUS_REFERENCES_VALUE: StatusReferencesProperty,67}68__all__ = (69 "Base",70 "BaseInScope",71 "Scope",72 "Scope2",73 "Activity",74 "Association",75 "Activity2",76 "Part",77 "Part2",78 "PartSet",79 "Service",80 "ServiceExecution",81 "User",82 "Team",83 "Property",84 "MultiReferenceProperty",85 "AttachmentProperty",86 "SelectListProperty",87 "DatetimeProperty",88 "Property2",89 "MultiReferenceProperty2",90 "AttachmentProperty2",91 "SelectListProperty2",92 "DatetimeProperty2",93 "ActivityReferencesProperty",94 "ScopeReferencesProperty",95 "UserReferencesProperty",96 "FormReferencesProperty",97 "StatusReferencesProperty",98 "AnyProperty",99 "PropertyValueFilter",100 "Notification",101 "property_type_to_class_map",...
Using AI Code Generation
1const { property } = require('fast-check');2property().check();3const { property } = require('fast-check');4property().check();5const { property } = require('fast-check');6property().check();7const { property } = require('fast-check');8property().check();9const { property } = require('fast-check');10property().check();11const { property } = require('fast-check');12property().check();13const { property } = require('fast-check');14property().check();15const { property } = require('fast-check');16property().check();17const { property } = require('fast-check');18property().check();19const { property } = require('fast-check');20property().check();21const { property } = require('fast-check');22property().check();23const { property } = require('fast-check');24property().check();25const { property } = require('fast-check');26property().check();27const { property } = require('fast-check');28property().check();29const { property } = require('fast-check');30property().check();
Using AI Code Generation
1const Property = require('fast-check').Property;2const fc = require('fast-check');3const {expect} = require('chai');4describe('test3', () => {5 it('should pass', () => {6 fc.assert(7 .anything()8 .then((value) => {9 expect(value).to.be.ok;10 })11 );12 });13});14const Property = require('fast-check').Property;15const fc = require('fast-check');16const {expect} = require('chai');17describe('test4', () => {18 it('should pass', () => {19 fc.assert(20 .anything()21 .then((value) => {22 expect(value).to.be.ok;23 })24 );25 });26});27const Property = require('fast-check').Property;28const fc = require('fast-check');29const {expect} = require('chai');30describe('test5', () => {31 it('should pass', () => {32 fc.assert(33 .anything()34 .then((value) => {35 expect(value).to.be.ok;36 })37 );38 });39});40const Property = require('fast-check').Property;41const fc = require('fast-check');42const {expect} = require('chai');43describe('test6', () => {44 it('should pass', () => {45 fc.assert(46 .anything()47 .then((value) => {48 expect(value).to.be.ok;49 })50 );51 });52});53const Property = require('fast-check').Property;54const fc = require('fast-check');55const {expect} = require('chai');56describe('test7', () => {57 it('should pass', () => {58 fc.assert(59 .anything()60 .then((value) => {61 expect(value).to.be.ok;62 })63 );64 });65});66const Property = require('fast-check
Using AI Code Generation
1var fc = require('fast-check');2var fc = require('fast-check');3fc.assert(4 fc.property(fc.integer(), function (n) {5 return n + 1 > n;6 })7);
Using AI Code Generation
1const fc = require('fast-check');2const { Property } = require('fast-check');3const myProperty = Property.forall('nat', (n) => {4 return n >= 0;5});6fc.assert(myProperty);7const fc = require('fast-check');8const { Property } = require('fast-check');9const myProperty = Property.forall('nat', (n) => {10 return n >= 0;11});12fc.assert(myProperty);
Using AI Code Generation
1import { Property } from 'fast-check';2import { testProperty } from 'jest-fast-check';3testProperty('test3', Property.forall('nat', 'nat', (a, b) => a + b >= a));4import { Property } from 'fast-check';5import { testProperty } from 'jest-fast-check';6testProperty('test4', Property.forall('nat', 'nat', (a, b) => a + b >= a));7import { Property } from 'fast-check';8import { testProperty } from 'jest-fast-check';9testProperty('test5', Property.forall('nat', 'nat', (a, b) => a + b >= a));10import { Property } from 'fast-check';11import { testProperty } from 'jest-fast-check';12testProperty('test6', Property.forall('nat', 'nat', (a, b) => a + b >= a));13import { Property } from 'fast-check';14import { testProperty } from 'jest-fast-check';15testProperty('test7', Property.forall('nat', 'nat', (a, b) => a + b >= a));16import { Property } from 'fast-check';17import { testProperty } from 'jest-fast-check';18testProperty('test8', Property.forall('nat', 'nat', (a, b) => a + b >= a));19import { Property } from 'fast-check';20import { testProperty } from 'jest-fast-check';21testProperty('test9', Property.forall('nat', 'nat', (a, b) => a + b >= a));22import { Property } from 'fast-check';23import { testProperty } from 'jest-fast-check';24testProperty('test10', Property.forall
Using AI Code Generation
1const { property } = require('fast-check');2property(3 fc.integer(),4 (x) => x * 2 === x + x5);6property().check({ numRuns: 100 });7property().check({ seed: 42 });8property().check({ verbose: true });9property().check({ maxSkips: 100 });10property().check({ endOnFailure: true });11property().check({ interruptAfterTimeLimit: 1000 });12property().check({ interruptAfterTimeLimit: 1000 });13property().check({ interruptAfterTimeLimit: 1000 });14property().check({ interruptAfterTimeLimit: 1000 });15property().check({ interruptAfterTimeLimit: 1000 });16property().check({ interruptAfterTimeLimit: 1000 });17property().check({ interruptAfterTimeLimit: 1000 });18property().check({ interruptAfterTimeLimit: 1000 });19property().check({ interruptAfterTimeLimit: 1000 });20property().check({ interruptAfterTimeLimit: 1000 });21property().check({ interruptAfterTimeLimit
Using AI Code Generation
1const {2} = require('fast-check');3const prop = property(4 (num) => {5 return num % 2 === 0;6 }7);8prop.assert(1000);9prop.assert(1000, 10000);10prop.assert(1000, 10000, 1234);11prop.assert(1000, 10000, 1234, (err) => {12 console.log('Property failed with error: ' + err);13});14prop.assert(1000, 10000, 1234, (err) => {15 console.log('Property failed with error: ' + err);16}, (err) => {17 console.log('Property failed to find a failing case: ' + err);18});19prop.assert(1000, 10000, 1234, (err) => {20 console.log('Property failed
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!!