Best JavaScript code snippet using ng-mocks
__init__.py
Source:__init__.py  
1"""2LANG_INFO is a dictionary structure to provide meta information about languages.3About name_local: capitalize it as if your language name was appearing4inside a sentence in your language.5The 'fallback' key can be used to specify a special fallback logic which doesn't6follow the traditional 'fr-ca' -> 'fr' fallback logic.7"""8LANG_INFO = {9    'af': {10        'bidi': False,11        'code': 'af',12        'name': 'Afrikaans',13        'name_local': 'Afrikaans',14    },15    'ar': {16        'bidi': True,17        'code': 'ar',18        'name': 'Arabic',19        'name_local': 'Ø§ÙØ¹Ø±Ø¨ÙÙØ©',20    },21    'ast': {22        'bidi': False,23        'code': 'ast',24        'name': 'Asturian',25        'name_local': 'asturianu',26    },27    'az': {28        'bidi': True,29        'code': 'az',30        'name': 'Azerbaijani',31        'name_local': 'AzÉrbaycanca',32    },33    'be': {34        'bidi': False,35        'code': 'be',36        'name': 'Belarusian',37        'name_local': 'белаÑÑÑкаÑ',38    },39    'bg': {40        'bidi': False,41        'code': 'bg',42        'name': 'Bulgarian',43        'name_local': 'бÑлгаÑÑки',44    },45    'bn': {46        'bidi': False,47        'code': 'bn',48        'name': 'Bengali',49        'name_local': 'বাà¦à¦²à¦¾',50    },51    'br': {52        'bidi': False,53        'code': 'br',54        'name': 'Breton',55        'name_local': 'brezhoneg',56    },57    'bs': {58        'bidi': False,59        'code': 'bs',60        'name': 'Bosnian',61        'name_local': 'bosanski',62    },63    'ca': {64        'bidi': False,65        'code': 'ca',66        'name': 'Catalan',67        'name_local': 'català',68    },69    'cs': {70        'bidi': False,71        'code': 'cs',72        'name': 'Czech',73        'name_local': 'Äesky',74    },75    'cy': {76        'bidi': False,77        'code': 'cy',78        'name': 'Welsh',79        'name_local': 'Cymraeg',80    },81    'da': {82        'bidi': False,83        'code': 'da',84        'name': 'Danish',85        'name_local': 'dansk',86    },87    'de': {88        'bidi': False,89        'code': 'de',90        'name': 'German',91        'name_local': 'Deutsch',92    },93    'dsb': {94        'bidi': False,95        'code': 'dsb',96        'name': 'Lower Sorbian',97        'name_local': 'dolnoserbski',98    },99    'el': {100        'bidi': False,101        'code': 'el',102        'name': 'Greek',103        'name_local': 'Îλληνικά',104    },105    'en': {106        'bidi': False,107        'code': 'en',108        'name': 'English',109        'name_local': 'English',110    },111    'en-au': {112        'bidi': False,113        'code': 'en-au',114        'name': 'Australian English',115        'name_local': 'Australian English',116    },117    'en-gb': {118        'bidi': False,119        'code': 'en-gb',120        'name': 'British English',121        'name_local': 'British English',122    },123    'eo': {124        'bidi': False,125        'code': 'eo',126        'name': 'Esperanto',127        'name_local': 'Esperanto',128    },129    'es': {130        'bidi': False,131        'code': 'es',132        'name': 'Spanish',133        'name_local': 'español',134    },135    'es-ar': {136        'bidi': False,137        'code': 'es-ar',138        'name': 'Argentinian Spanish',139        'name_local': 'español de Argentina',140    },141    'es-co': {142        'bidi': False,143        'code': 'es-co',144        'name': 'Colombian Spanish',145        'name_local': 'español de Colombia',146    },147    'es-mx': {148        'bidi': False,149        'code': 'es-mx',150        'name': 'Mexican Spanish',151        'name_local': 'español de Mexico',152    },153    'es-ni': {154        'bidi': False,155        'code': 'es-ni',156        'name': 'Nicaraguan Spanish',157        'name_local': 'español de Nicaragua',158    },159    'es-ve': {160        'bidi': False,161        'code': 'es-ve',162        'name': 'Venezuelan Spanish',163        'name_local': 'español de Venezuela',164    },165    'et': {166        'bidi': False,167        'code': 'et',168        'name': 'Estonian',169        'name_local': 'eesti',170    },171    'eu': {172        'bidi': False,173        'code': 'eu',174        'name': 'Basque',175        'name_local': 'Basque',176    },177    'fa': {178        'bidi': True,179        'code': 'fa',180        'name': 'Persian',181        'name_local': 'ÙØ§Ø±Ø³Û',182    },183    'fi': {184        'bidi': False,185        'code': 'fi',186        'name': 'Finnish',187        'name_local': 'suomi',188    },189    'fr': {190        'bidi': False,191        'code': 'fr',192        'name': 'French',193        'name_local': 'français',194    },195    'fy': {196        'bidi': False,197        'code': 'fy',198        'name': 'Frisian',199        'name_local': 'frysk',200    },201    'ga': {202        'bidi': False,203        'code': 'ga',204        'name': 'Irish',205        'name_local': 'Gaeilge',206    },207    'gd': {208        'bidi': False,209        'code': 'gd',210        'name': 'Scottish Gaelic',211        'name_local': 'Gàidhlig',212    },213    'gl': {214        'bidi': False,215        'code': 'gl',216        'name': 'Galician',217        'name_local': 'galego',218    },219    'he': {220        'bidi': True,221        'code': 'he',222        'name': 'Hebrew',223        'name_local': '×¢×ר×ת',224    },225    'hi': {226        'bidi': False,227        'code': 'hi',228        'name': 'Hindi',229        'name_local': 'Hindi',230    },231    'hr': {232        'bidi': False,233        'code': 'hr',234        'name': 'Croatian',235        'name_local': 'Hrvatski',236    },237    'hsb': {238        'bidi': False,239        'code': 'hsb',240        'name': 'Upper Sorbian',241        'name_local': 'hornjoserbsce',242    },243    'hu': {244        'bidi': False,245        'code': 'hu',246        'name': 'Hungarian',247        'name_local': 'Magyar',248    },249    'ia': {250        'bidi': False,251        'code': 'ia',252        'name': 'Interlingua',253        'name_local': 'Interlingua',254    },255    'io': {256        'bidi': False,257        'code': 'io',258        'name': 'Ido',259        'name_local': 'ido',260    },261    'id': {262        'bidi': False,263        'code': 'id',264        'name': 'Indonesian',265        'name_local': 'Bahasa Indonesia',266    },267    'is': {268        'bidi': False,269        'code': 'is',270        'name': 'Icelandic',271        'name_local': 'Ãslenska',272    },273    'it': {274        'bidi': False,275        'code': 'it',276        'name': 'Italian',277        'name_local': 'italiano',278    },279    'ja': {280        'bidi': False,281        'code': 'ja',282        'name': 'Japanese',283        'name_local': 'æ¥æ¬èª',284    },285    'ka': {286        'bidi': False,287        'code': 'ka',288        'name': 'Georgian',289        'name_local': 'á¥áá áá£áá',290    },291    'kab': {292        'bidi': False,293        'code': 'kab',294        'name': 'Kabyle',295        'name_local': 'taqbaylit',296    },297    'kk': {298        'bidi': False,299        'code': 'kk',300        'name': 'Kazakh',301        'name_local': 'ÒазаÒ',302    },303    'km': {304        'bidi': False,305        'code': 'km',306        'name': 'Khmer',307        'name_local': 'Khmer',308    },309    'kn': {310        'bidi': False,311        'code': 'kn',312        'name': 'Kannada',313        'name_local': 'Kannada',314    },315    'ko': {316        'bidi': False,317        'code': 'ko',318        'name': 'Korean',319        'name_local': 'íêµì´',320    },321    'lb': {322        'bidi': False,323        'code': 'lb',324        'name': 'Luxembourgish',325        'name_local': 'Lëtzebuergesch',326    },327    'lt': {328        'bidi': False,329        'code': 'lt',330        'name': 'Lithuanian',331        'name_local': 'LietuviÅ¡kai',332    },333    'lv': {334        'bidi': False,335        'code': 'lv',336        'name': 'Latvian',337        'name_local': 'latvieÅ¡u',338    },339    'mk': {340        'bidi': False,341        'code': 'mk',342        'name': 'Macedonian',343        'name_local': 'ÐакедонÑки',344    },345    'ml': {346        'bidi': False,347        'code': 'ml',348        'name': 'Malayalam',349        'name_local': 'Malayalam',350    },351    'mn': {352        'bidi': False,353        'code': 'mn',354        'name': 'Mongolian',355        'name_local': 'Mongolian',356    },357    'mr': {358        'bidi': False,359        'code': 'mr',360        'name': 'Marathi',361        'name_local': 'मराठà¥',362    },363    'my': {364        'bidi': False,365        'code': 'my',366        'name': 'Burmese',367        'name_local': 'áá¼ááºáá¬áá¬áá¬',368    },369    'nb': {370        'bidi': False,371        'code': 'nb',372        'name': 'Norwegian Bokmal',373        'name_local': 'norsk (bokmÃ¥l)',374    },375    'ne': {376        'bidi': False,377        'code': 'ne',378        'name': 'Nepali',379        'name_local': 'नà¥à¤ªà¤¾à¤²à¥',380    },381    'nl': {382        'bidi': False,383        'code': 'nl',384        'name': 'Dutch',385        'name_local': 'Nederlands',386    },387    'nn': {388        'bidi': False,389        'code': 'nn',390        'name': 'Norwegian Nynorsk',391        'name_local': 'norsk (nynorsk)',392    },393    'no': {394        'bidi': False,395        'code': 'no',396        'name': 'Norwegian',397        'name_local': 'norsk',398    },399    'os': {400        'bidi': False,401        'code': 'os',402        'name': 'Ossetic',403        'name_local': 'ÐÑон',404    },405    'pa': {406        'bidi': False,407        'code': 'pa',408        'name': 'Punjabi',409        'name_local': 'Punjabi',410    },411    'pl': {412        'bidi': False,413        'code': 'pl',414        'name': 'Polish',415        'name_local': 'polski',416    },417    'pt': {418        'bidi': False,419        'code': 'pt',420        'name': 'Portuguese',421        'name_local': 'Português',422    },423    'pt-br': {424        'bidi': False,425        'code': 'pt-br',426        'name': 'Brazilian Portuguese',427        'name_local': 'Português Brasileiro',428    },429    'ro': {430        'bidi': False,431        'code': 'ro',432        'name': 'Romanian',433        'name_local': 'RomânÄ',434    },435    'ru': {436        'bidi': False,437        'code': 'ru',438        'name': 'Russian',439        'name_local': 'РÑÑÑкий',440    },441    'sk': {442        'bidi': False,443        'code': 'sk',444        'name': 'Slovak',445        'name_local': 'Slovensky',446    },447    'sl': {448        'bidi': False,449        'code': 'sl',450        'name': 'Slovenian',451        'name_local': 'SlovenÅ¡Äina',452    },453    'sq': {454        'bidi': False,455        'code': 'sq',456        'name': 'Albanian',457        'name_local': 'shqip',458    },459    'sr': {460        'bidi': False,461        'code': 'sr',462        'name': 'Serbian',463        'name_local': 'ÑÑпÑки',464    },465    'sr-latn': {466        'bidi': False,467        'code': 'sr-latn',468        'name': 'Serbian Latin',469        'name_local': 'srpski (latinica)',470    },471    'sv': {472        'bidi': False,473        'code': 'sv',474        'name': 'Swedish',475        'name_local': 'svenska',476    },477    'sw': {478        'bidi': False,479        'code': 'sw',480        'name': 'Swahili',481        'name_local': 'Kiswahili',482    },483    'ta': {484        'bidi': False,485        'code': 'ta',486        'name': 'Tamil',487        'name_local': 'தமிழà¯',488    },489    'te': {490        'bidi': False,491        'code': 'te',492        'name': 'Telugu',493        'name_local': 'à°¤à±à°²à±à°à±',494    },495    'th': {496        'bidi': False,497        'code': 'th',498        'name': 'Thai',499        'name_local': 'ภาษาà¹à¸à¸¢',500    },501    'tr': {502        'bidi': False,503        'code': 'tr',504        'name': 'Turkish',505        'name_local': 'Türkçe',506    },507    'tt': {508        'bidi': False,509        'code': 'tt',510        'name': 'Tatar',511        'name_local': 'ТаÑаÑÑа',512    },513    'udm': {514        'bidi': False,515        'code': 'udm',516        'name': 'Udmurt',517        'name_local': 'УдмÑÑÑ',518    },519    'uk': {520        'bidi': False,521        'code': 'uk',522        'name': 'Ukrainian',523        'name_local': 'УкÑаÑнÑÑка',524    },525    'ur': {526        'bidi': True,527        'code': 'ur',528        'name': 'Urdu',529        'name_local': 'اردÙ',530    },531    'vi': {532        'bidi': False,533        'code': 'vi',534        'name': 'Vietnamese',535        'name_local': 'TiêÌng Việt',536    },537    'zh-cn': {538        'fallback': ['zh-hans'],539    },540    'zh-hans': {541        'bidi': False,542        'code': 'zh-hans',543        'name': 'Simplified Chinese',544        'name_local': 'ç®ä½ä¸æ',545    },546    'zh-hant': {547        'bidi': False,548        'code': 'zh-hant',549        'name': 'Traditional Chinese',550        'name_local': 'ç¹é«ä¸æ',551    },552    'zh-hk': {553        'fallback': ['zh-hant'],554    },555    'zh-mo': {556        'fallback': ['zh-hant'],557    },558    'zh-my': {559        'fallback': ['zh-hans'],560    },561    'zh-sg': {562        'fallback': ['zh-hans'],563    },564    'zh-tw': {565        'fallback': ['zh-hant'],566    },...schema.py
Source:schema.py  
1SCHEMA_ORG_CHOICES = (2    ('Organization', 'Organization'),3    ('Airline', 'Organization > Airline'),4    ('Corporation', 'Organization > Corporation'),5    ('EducationalOrganization', 'Organization > EducationalOrganization'),6    ('CollegeOrUniversity', 'Organization > EducationalOrganization > CollegeOrUniversity'),7    ('ElementarySchool', 'Organization > EducationalOrganization > ElementarySchool'),8    ('HighSchool', 'Organization > EducationalOrganization > HighSchool'),9    ('MiddleSchool', 'Organization > EducationalOrganization > MiddleSchool'),10    ('Preschool', 'Organization > EducationalOrganization > Preschool'),11    ('School', 'Organization > EducationalOrganization > School'),12    ('GovernmentOrganization', 'Organization > GovernmentOrganization'),13    ('LocalBusiness', 'Organization > LocalBusiness'),14    ('AnimalShelter', 'Organization > LocalBusiness > AnimalShelter'),15    ('AutomotiveBusiness', 'Organization > LocalBusiness > AutomotiveBusiness'),16    ('AutoBodyShop', 'Organization > LocalBusiness > AutomotiveBusiness > AutoBodyShop'),17    ('AutoDealer', 'Organization > LocalBusiness > AutomotiveBusiness > AutoDealer'),18    ('AutoPartsStore', 'Organization > LocalBusiness > AutomotiveBusiness > AutoPartsStore'),19    ('AutoRental', 'Organization > LocalBusiness > AutomotiveBusiness > AutoRental'),20    ('AutoRepair', 'Organization > LocalBusiness > AutomotiveBusiness > AutoRepair'),21    ('AutoWash', 'Organization > LocalBusiness > AutomotiveBusiness > AutoWash'),22    ('GasStation', 'Organization > LocalBusiness > AutomotiveBusiness > GasStation'),23    ('MotorcycleDealer', 'Organization > LocalBusiness > AutomotiveBusiness > MotorcycleDealer'),24    ('MotorcycleRepair', 'Organization > LocalBusiness > AutomotiveBusiness > MotorcycleRepair'),25    ('ChildCare', 'Organization > LocalBusiness > ChildCare'),26    ('Dentist', 'Organization > LocalBusiness > Dentist'),27    ('DryCleaningOrLaundry', 'Organization > LocalBusiness > DryCleaningOrLaundry'),28    ('EmergencyService', 'Organization > LocalBusiness > EmergencyService'),29    ('FireStation', 'Organization > LocalBusiness > EmergencyService > FireStation'),30    ('Hospital', 'Organization > LocalBusiness > EmergencyService > Hospital'),31    ('PoliceStation', 'Organization > LocalBusiness > EmergencyService > PoliceStation'),32    ('EmploymentAgency', 'Organization > LocalBusiness > EmploymentAgency'),33    ('EntertainmentBusiness', 'Organization > LocalBusiness > EntertainmentBusiness'),34    ('AdultEntertainment', 'Organization > LocalBusiness > EntertainmentBusiness > AdultEntertainment'),35    ('AmusementPark', 'Organization > LocalBusiness > EntertainmentBusiness > AmusementPark'),36    ('ArtGallery', 'Organization > LocalBusiness > EntertainmentBusiness > ArtGallery'),37    ('Casino', 'Organization > LocalBusiness > EntertainmentBusiness > Casino'),38    ('ComedyClub', 'Organization > LocalBusiness > EntertainmentBusiness > ComedyClub'),39    ('MovieTheater', 'Organization > LocalBusiness > EntertainmentBusiness > MovieTheater'),40    ('NightClub', 'Organization > LocalBusiness > EntertainmentBusiness > NightClub'),41    ('FinancialService', 'Organization > LocalBusiness > FinancialService'),42    ('AccountingService', 'Organization > LocalBusiness > FinancialService > AccountingService'),43    ('AutomatedTeller', 'Organization > LocalBusiness > FinancialService > AutomatedTeller'),44    ('BankOrCreditUnion', 'Organization > LocalBusiness > FinancialService > BankOrCreditUnion'),45    ('InsuranceAgency', 'Organization > LocalBusiness > FinancialService > InsuranceAgency'),46    ('FoodEstablishment', 'Organization > LocalBusiness > FoodEstablishment'),47    ('Bakery', 'Organization > LocalBusiness > FoodEstablishment > Bakery'),48    ('BarOrPub', 'Organization > LocalBusiness > FoodEstablishment > BarOrPub'),49    ('Brewery', 'Organization > LocalBusiness > FoodEstablishment > Brewery'),50    ('CafeOrCoffeeShop', 'Organization > LocalBusiness > FoodEstablishment > CafeOrCoffeeShop'),51    ('FastFoodRestaurant', 'Organization > LocalBusiness > FoodEstablishment > FastFoodRestaurant'),52    ('IceCreamShop', 'Organization > LocalBusiness > FoodEstablishment > IceCreamShop'),53    ('Restaurant', 'Organization > LocalBusiness > FoodEstablishment > Restaurant'),54    ('Winery', 'Organization > LocalBusiness > FoodEstablishment > Winery'),55    ('GovernmentOffice', 'Organization > LocalBusiness > GovernmentOffice'),56    ('PostOffice', 'Organization > LocalBusiness > GovernmentOffice > PostOffice'),57    ('HealthAndBeautyBusiness', 'Organization > LocalBusiness > HealthAndBeautyBusiness'),58    ('BeautySalon', 'Organization > LocalBusiness > HealthAndBeautyBusiness > BeautySalon'),59    ('DaySpa', 'Organization > LocalBusiness > HealthAndBeautyBusiness > DaySpa'),60    ('HairSalon', 'Organization > LocalBusiness > HealthAndBeautyBusiness > HairSalon'),61    ('HealthClub', 'Organization > LocalBusiness > HealthAndBeautyBusiness > HealthClub'),62    ('NailSalon', 'Organization > LocalBusiness > HealthAndBeautyBusiness > NailSalon'),63    ('TattooParlor', 'Organization > LocalBusiness > HealthAndBeautyBusiness > TattooParlor'),64    ('HomeAndConstructionBusiness', 'Organization > LocalBusiness > HomeAndConstructionBusiness'),65    ('Electrician', 'Organization > LocalBusiness > HomeAndConstructionBusiness > Electrician'),66    ('GeneralContractor', 'Organization > LocalBusiness > HomeAndConstructionBusiness > GeneralContractor'),67    ('HVACBusiness', 'Organization > LocalBusiness > HomeAndConstructionBusiness > HVACBusiness'),68    ('HousePainter', 'Organization > LocalBusiness > HomeAndConstructionBusiness > HousePainter'),69    ('Locksmith', 'Organization > LocalBusiness > HomeAndConstructionBusiness > Locksmith'),70    ('MovingCompany', 'Organization > LocalBusiness > HomeAndConstructionBusiness > MovingCompany'),71    ('Plumber', 'Organization > LocalBusiness > HomeAndConstructionBusiness > Plumber'),72    ('RoofingContractor', 'Organization > LocalBusiness > HomeAndConstructionBusiness > RoofingContractor'),73    ('InternetCafe', 'Organization > LocalBusiness > InternetCafe'),74    ('LegalService', 'Organization > LocalBusiness > LegalService'),75    ('Attorney', 'Organization > LocalBusiness > LegalService > Attorney'),76    ('Notary', 'Organization > LocalBusiness > LegalService > Notary'),77    ('Library', 'Organization > LocalBusiness > Library'),78    ('LodgingBusiness', 'Organization > LocalBusiness > LodgingBusiness'),79    ('BedAndBreakfast', 'Organization > LocalBusiness > LodgingBusiness > BedAndBreakfast'),80    ('Campground', 'Organization > LocalBusiness > LodgingBusiness > Campground'),81    ('Hostel', 'Organization > LocalBusiness > LodgingBusiness > Hostel'),82    ('Hotel', 'Organization > LocalBusiness > LodgingBusiness > Hotel'),83    ('Motel', 'Organization > LocalBusiness > LodgingBusiness > Motel'),84    ('Resort', 'Organization > LocalBusiness > LodgingBusiness > Resort'),85    ('ProfessionalService', 'Organization > LocalBusiness > ProfessionalService'),86    ('RadioStation', 'Organization > LocalBusiness > RadioStation'),87    ('RealEstateAgent', 'Organization > LocalBusiness > RealEstateAgent'),88    ('RecyclingCenter', 'Organization > LocalBusiness > RecyclingCenter'),89    ('SelfStorage', 'Organization > LocalBusiness > SelfStorage'),90    ('ShoppingCenter', 'Organization > LocalBusiness > ShoppingCenter'),91    ('SportsActivityLocation', 'Organization > LocalBusiness > SportsActivityLocation'),92    ('BowlingAlley', 'Organization > LocalBusiness > SportsActivityLocation > BowlingAlley'),93    ('ExerciseGym', 'Organization > LocalBusiness > SportsActivityLocation > ExerciseGym'),94    ('GolfCourse', 'Organization > LocalBusiness > SportsActivityLocation > GolfCourse'),95    ('HealthClub', 'Organization > LocalBusiness > SportsActivityLocation > HealthClub'),96    ('PublicSwimmingPool', 'Organization > LocalBusiness > SportsActivityLocation > PublicSwimmingPool'),97    ('SkiResort', 'Organization > LocalBusiness > SportsActivityLocation > SkiResort'),98    ('SportsClub', 'Organization > LocalBusiness > SportsActivityLocation > SportsClub'),99    ('StadiumOrArena', 'Organization > LocalBusiness > SportsActivityLocation > StadiumOrArena'),100    ('TennisComplex', 'Organization > LocalBusiness > SportsActivityLocation > TennisComplex'),101    ('Store', 'Organization > LocalBusiness > Store'),102    ('AutoPartsStore', 'Organization > LocalBusiness > Store > AutoPartsStore'),103    ('BikeStore', 'Organization > LocalBusiness > Store > BikeStore'),104    ('BookStore', 'Organization > LocalBusiness > Store > BookStore'),105    ('ClothingStore', 'Organization > LocalBusiness > Store > ClothingStore'),106    ('ComputerStore', 'Organization > LocalBusiness > Store > ComputerStore'),107    ('ConvenienceStore', 'Organization > LocalBusiness > Store > ConvenienceStore'),108    ('DepartmentStore', 'Organization > LocalBusiness > Store > DepartmentStore'),109    ('ElectronicsStore', 'Organization > LocalBusiness > Store > ElectronicsStore'),110    ('Florist', 'Organization > LocalBusiness > Store > Florist'),111    ('FurnitureStore', 'Organization > LocalBusiness > Store > FurnitureStore'),112    ('GardenStore', 'Organization > LocalBusiness > Store > GardenStore'),113    ('GroceryStore', 'Organization > LocalBusiness > Store > GroceryStore'),114    ('HardwareStore', 'Organization > LocalBusiness > Store > HardwareStore'),115    ('HobbyShop', 'Organization > LocalBusiness > Store > HobbyShop'),116    ('HomeGoodsStore', 'Organization > LocalBusiness > Store > HomeGoodsStore'),117    ('JewelryStore', 'Organization > LocalBusiness > Store > JewelryStore'),118    ('LiquorStore', 'Organization > LocalBusiness > Store > LiquorStore'),119    ('MensClothingStore', 'Organization > LocalBusiness > Store > MensClothingStore'),120    ('MobilePhoneStore', 'Organization > LocalBusiness > Store > MobilePhoneStore'),121    ('MovieRentalStore', 'Organization > LocalBusiness > Store > MovieRentalStore'),122    ('MusicStore', 'Organization > LocalBusiness > Store > MusicStore'),123    ('OfficeEquipmentStore', 'Organization > LocalBusiness > Store > OfficeEquipmentStore'),124    ('OutletStore', 'Organization > LocalBusiness > Store > OutletStore'),125    ('PawnShop', 'Organization > LocalBusiness > Store > PawnShop'),126    ('PetStore', 'Organization > LocalBusiness > Store > PetStore'),127    ('ShoeStore', 'Organization > LocalBusiness > Store > ShoeStore'),128    ('SportingGoodsStore', 'Organization > LocalBusiness > Store > SportingGoodsStore'),129    ('TireShop', 'Organization > LocalBusiness > Store > TireShop'),130    ('ToyStore', 'Organization > LocalBusiness > Store > ToyStore'),131    ('WholesaleStore', 'Organization > LocalBusiness > Store > WholesaleStore'),132    ('TelevisionStation', 'Organization > LocalBusiness > TelevisionStation'),133    ('TouristInformationCenter', 'Organization > LocalBusiness > TouristInformationCenter'),134    ('TravelAgency', 'Organization > LocalBusiness > TravelAgency'),135    ('MedicalOrganization', 'Organization > MedicalOrganization'),136    ('Dentist', 'Organization > MedicalOrganization > Dentist'),137    ('Hospital', 'Organization > MedicalOrganization > Hospital'),138    ('Pharmacy', 'Organization > MedicalOrganization > Pharmacy'),139    ('Physician', 'Organization > MedicalOrganization > Physician'),140    ('NGO', 'Organization > NGO'),141    ('PerformingGroup', 'Organization > PerformingGroup'),142    ('DanceGroup', 'Organization > PerformingGroup > DanceGroup'),143    ('MusicGroup', 'Organization > PerformingGroup > MusicGroup'),144    ('TheaterGroup', 'Organization > PerformingGroup > TheaterGroup'),145    ('SportsOrganization', 'Organization > SportsOrganization'),146    ('SportsTeam', 'Organization > SportsOrganization > SportsTeam'),147)148SCHEMA_ACTION_CHOICES = (149    ('OrderAction', 'OrderAction'),150    ('ReserveAction', 'ReserveAction'),151)152SCHEMA_RESULT_CHOICES = (153    ('Reservation', 'Reservation'),154    ('BusReservation', 'BusReservation'),155    ('EventReservation', 'EventReservation'),156    ('FlightReservation', 'FlightReservation'),157    ('FoodEstablishmentReservation', 'FoodEstablishmentReservation'),158    ('LodgingReservation', 'LodgingReservation'),159    ('RentalCarReservation', 'RentalCarReservation'),160    ('ReservationPackage', 'ReservationPackage'),161    ('TaxiReservation', 'TaxiReservation'),162    ('TrainReservation', 'TrainReservation'),...browser_dbg_variables-view-05.js
Source:browser_dbg_variables-view-05.js  
1/* Any copyright is dedicated to the Public Domain.2   http://creativecommons.org/publicdomain/zero/1.0/ */3/**4 * Tests that grips are correctly applied to variables and properties.5 */6const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";7function test() {8  initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {9    let variables = aPanel.panelWin.DebuggerView.Variables;10    let globalScope = variables.addScope("Test-Global");11    let localScope = variables.addScope("Test-Local");12    ok(globalScope, "The globalScope hasn't been created correctly.");13    ok(localScope, "The localScope hasn't been created correctly.");14    let windowVar = globalScope.addItem("window");15    let documentVar = globalScope.addItem("document");16    ok(windowVar, "The windowVar hasn't been created correctly.");17    ok(documentVar, "The documentVar hasn't been created correctly.");18    windowVar.setGrip({ type: "object", class: "Window" });19    documentVar.setGrip({ type: "object", class: "HTMLDocument" });20    let localVar0 = localScope.addItem("localVar0");21    let localVar1 = localScope.addItem("localVar1");22    let localVar2 = localScope.addItem("localVar2");23    let localVar3 = localScope.addItem("localVar3");24    let localVar4 = localScope.addItem("localVar4");25    let localVar5 = localScope.addItem("localVar5");26    let localVar6 = localScope.addItem("localVar6");27    let localVar7 = localScope.addItem("localVar7");28    let localVar8 = localScope.addItem("localVar8");29    let localVar9 = localScope.addItem("localVar9");30    ok(localVar0, "The localVar0 hasn't been created correctly.");31    ok(localVar1, "The localVar1 hasn't been created correctly.");32    ok(localVar2, "The localVar2 hasn't been created correctly.");33    ok(localVar3, "The localVar3 hasn't been created correctly.");34    ok(localVar4, "The localVar4 hasn't been created correctly.");35    ok(localVar5, "The localVar5 hasn't been created correctly.");36    ok(localVar6, "The localVar6 hasn't been created correctly.");37    ok(localVar7, "The localVar7 hasn't been created correctly.");38    ok(localVar8, "The localVar8 hasn't been created correctly.");39    ok(localVar9, "The localVar9 hasn't been created correctly.");40    localVar0.setGrip(42);41    localVar1.setGrip(true);42    localVar2.setGrip("nasu");43    localVar3.setGrip({ type: "undefined" });44    localVar4.setGrip({ type: "null" });45    localVar5.setGrip({ type: "object", class: "Object" });46    localVar6.setGrip({ type: "Infinity" });47    localVar7.setGrip({ type: "-Infinity" });48    localVar8.setGrip({ type: "NaN" });49    localVar9.setGrip({ type: "-0" });50    localVar5.addItems({51      someProp0: { value: 42, enumerable: true },52      someProp1: { value: true, enumerable: true },53      someProp2: { value: "nasu", enumerable: true },54      someProp3: { value: { type: "undefined" }, enumerable: true },55      someProp4: { value: { type: "null" }, enumerable: true },56      someProp5: { value: { type: "object", class: "Object" }, enumerable: true },57      someProp6: { value: { type: "Infinity" }, enumerable: true },58      someProp7: { value: { type: "-Infinity" }, enumerable: true },59      someProp8: { value: { type: "NaN" }, enumerable: true },60      someProp9: { value: { type: "-0" }, enumerable: true },61      someUndefined: {62        get: { type: "undefined" },63        set: { type: "undefined" },64        enumerable: true65      },66      someAccessor: {67        get: { type: "object", class: "Function" },68        set: { type: "undefined" },69        enumerable: true70      }71    });72    localVar5.get("someProp5").addItems({73      someProp0: { value: 42, enumerable: true },74      someProp1: { value: true, enumerable: true },75      someProp2: { value: "nasu", enumerable: true },76      someProp3: { value: { type: "undefined" }, enumerable: true },77      someProp4: { value: { type: "null" }, enumerable: true },78      someProp5: { value: { type: "object", class: "Object" }, enumerable: true },79      someProp6: { value: { type: "Infinity" }, enumerable: true },80      someProp7: { value: { type: "-Infinity" }, enumerable: true },81      someProp8: { value: { type: "NaN" }, enumerable: true },82      someProp9: { value: { type: "-0" }, enumerable: true },83      someUndefined: {84        get: { type: "undefined" },85        set: { type: "undefined" },86        enumerable: true87      },88      someAccessor: {89        get: { type: "object", class: "Function" },90        set: { type: "undefined" },91        enumerable: true92      }93    });94    is(globalScope.target.querySelector(".enum").childNodes.length, 0,95      "The globalScope doesn't contain all the created enumerable variable elements.");96    is(globalScope.target.querySelector(".nonenum").childNodes.length, 2,97      "The globalScope doesn't contain all the created non-enumerable variable elements.");98    is(localScope.target.querySelector(".enum").childNodes.length, 0,99      "The localScope doesn't contain all the created enumerable variable elements.");100    is(localScope.target.querySelector(".nonenum").childNodes.length, 10,101      "The localScope doesn't contain all the created non-enumerable variable elements.");102    is(localVar5.target.querySelector(".enum").childNodes.length, 12,103      "The localVar5 doesn't contain all the created enumerable properties.");104    is(localVar5.target.querySelector(".nonenum").childNodes.length, 0,105      "The localVar5 doesn't contain all the created non-enumerable properties.");106    is(localVar5.get("someProp5").target.querySelector(".enum").childNodes.length, 12,107      "The localVar5.someProp5 doesn't contain all the created enumerable properties.");108    is(localVar5.get("someProp5").target.querySelector(".nonenum").childNodes.length, 0,109      "The localVar5.someProp5 doesn't contain all the created non-enumerable properties.");110    is(windowVar.target.querySelector(".value").getAttribute("value"), "Window",111      "The grip information for the windowVar wasn't set correctly.");112    is(documentVar.target.querySelector(".value").getAttribute("value"), "HTMLDocument",113      "The grip information for the documentVar wasn't set correctly.");114    is(localVar0.target.querySelector(".value").getAttribute("value"), "42",115      "The grip information for the localVar0 wasn't set correctly.");116    is(localVar1.target.querySelector(".value").getAttribute("value"), "true",117      "The grip information for the localVar1 wasn't set correctly.");118    is(localVar2.target.querySelector(".value").getAttribute("value"), "\"nasu\"",119      "The grip information for the localVar2 wasn't set correctly.");120    is(localVar3.target.querySelector(".value").getAttribute("value"), "undefined",121      "The grip information for the localVar3 wasn't set correctly.");122    is(localVar4.target.querySelector(".value").getAttribute("value"), "null",123      "The grip information for the localVar4 wasn't set correctly.");124    is(localVar5.target.querySelector(".value").getAttribute("value"), "Object",125      "The grip information for the localVar5 wasn't set correctly.");126    is(localVar6.target.querySelector(".value").getAttribute("value"), "Infinity",127      "The grip information for the localVar6 wasn't set correctly.");128    is(localVar7.target.querySelector(".value").getAttribute("value"), "-Infinity",129      "The grip information for the localVar7 wasn't set correctly.");130    is(localVar8.target.querySelector(".value").getAttribute("value"), "NaN",131      "The grip information for the localVar8 wasn't set correctly.");132    is(localVar9.target.querySelector(".value").getAttribute("value"), "-0",133      "The grip information for the localVar9 wasn't set correctly.");134    is(localVar5.get("someProp0").target.querySelector(".value").getAttribute("value"), "42",135      "The grip information for the someProp0 wasn't set correctly.");136    is(localVar5.get("someProp1").target.querySelector(".value").getAttribute("value"), "true",137      "The grip information for the someProp1 wasn't set correctly.");138    is(localVar5.get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"",139      "The grip information for the someProp2 wasn't set correctly.");140    is(localVar5.get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined",141      "The grip information for the someProp3 wasn't set correctly.");142    is(localVar5.get("someProp4").target.querySelector(".value").getAttribute("value"), "null",143      "The grip information for the someProp4 wasn't set correctly.");144    is(localVar5.get("someProp5").target.querySelector(".value").getAttribute("value"), "Object",145      "The grip information for the someProp5 wasn't set correctly.");146    is(localVar5.get("someProp6").target.querySelector(".value").getAttribute("value"), "Infinity",147      "The grip information for the someProp6 wasn't set correctly.");148    is(localVar5.get("someProp7").target.querySelector(".value").getAttribute("value"), "-Infinity",149      "The grip information for the someProp7 wasn't set correctly.");150    is(localVar5.get("someProp8").target.querySelector(".value").getAttribute("value"), "NaN",151      "The grip information for the someProp8 wasn't set correctly.");152    is(localVar5.get("someProp9").target.querySelector(".value").getAttribute("value"), "-0",153      "The grip information for the someProp9 wasn't set correctly.");154    is(localVar5.get("someUndefined").target.querySelector(".value").getAttribute("value"), "",155      "The grip information for the someUndefined wasn't set correctly.");156    is(localVar5.get("someAccessor").target.querySelector(".value").getAttribute("value"), "",157      "The grip information for the someAccessor wasn't set correctly.");158    is(localVar5.get("someProp5").get("someProp0").target.querySelector(".value").getAttribute("value"), "42",159      "The grip information for the sub-someProp0 wasn't set correctly.");160    is(localVar5.get("someProp5").get("someProp1").target.querySelector(".value").getAttribute("value"), "true",161      "The grip information for the sub-someProp1 wasn't set correctly.");162    is(localVar5.get("someProp5").get("someProp2").target.querySelector(".value").getAttribute("value"), "\"nasu\"",163      "The grip information for the sub-someProp2 wasn't set correctly.");164    is(localVar5.get("someProp5").get("someProp3").target.querySelector(".value").getAttribute("value"), "undefined",165      "The grip information for the sub-someProp3 wasn't set correctly.");166    is(localVar5.get("someProp5").get("someProp4").target.querySelector(".value").getAttribute("value"), "null",167      "The grip information for the sub-someProp4 wasn't set correctly.");168    is(localVar5.get("someProp5").get("someProp5").target.querySelector(".value").getAttribute("value"), "Object",169      "The grip information for the sub-someProp5 wasn't set correctly.");170    is(localVar5.get("someProp5").get("someProp6").target.querySelector(".value").getAttribute("value"), "Infinity",171      "The grip information for the sub-someProp6 wasn't set correctly.");172    is(localVar5.get("someProp5").get("someProp7").target.querySelector(".value").getAttribute("value"), "-Infinity",173      "The grip information for the sub-someProp7 wasn't set correctly.");174    is(localVar5.get("someProp5").get("someProp8").target.querySelector(".value").getAttribute("value"), "NaN",175      "The grip information for the sub-someProp8 wasn't set correctly.");176    is(localVar5.get("someProp5").get("someProp9").target.querySelector(".value").getAttribute("value"), "-0",177      "The grip information for the sub-someProp9 wasn't set correctly.");178    is(localVar5.get("someProp5").get("someUndefined").target.querySelector(".value").getAttribute("value"), "",179      "The grip information for the sub-someUndefined wasn't set correctly.");180    is(localVar5.get("someProp5").get("someAccessor").target.querySelector(".value").getAttribute("value"), "",181      "The grip information for the sub-someAccessor wasn't set correctly.");182    closeDebuggerAndFinish(aPanel);183  });...browser_dbg_propertyview-06.js
Source:browser_dbg_propertyview-06.js  
1/* vim:set ts=2 sw=2 sts=2 et: */2/*3 * Any copyright is dedicated to the Public Domain.4 * http://creativecommons.org/publicdomain/zero/1.0/5 */6var gPane = null;7var gTab = null;8var gDebuggee = null;9var gDebugger = null;10function test() {11  debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {12    gTab = aTab;13    gDebuggee = aDebuggee;14    gPane = aPane;15    gDebugger = gPane.contentWindow;16    testSimpleCall();17  });18}19function testSimpleCall() {20  gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {21    Services.tm.currentThread.dispatch({ run: function() {22      let globalScope = gDebugger.DebuggerView.Properties.addScope("Global");23      let localScope = gDebugger.DebuggerView.Properties.addScope("Local");24      globalScope.empty();25      localScope.empty();26      let windowVar = globalScope.addVar("window");27      let documentVar = globalScope.addVar("document");28      let localVar0 = localScope.addVar("localVariable");29      let localVar1 = localScope.addVar("localVar1");30      let localVar2 = localScope.addVar("localVar2");31      let localVar3 = localScope.addVar("localVar3");32      let localVar4 = localScope.addVar("localVar4");33      let localVar5 = localScope.addVar("localVar5");34      localVar0.setGrip(42);35      localVar1.setGrip(true);36      localVar2.setGrip("nasu");37      localVar3.setGrip({ "type": "undefined" });38      localVar4.setGrip({ "type": "null" });39      localVar5.setGrip({ "type": "object", "class": "Object" });40      localVar5.addProperties({ "someProp0": { "value": 42 },41                                "someProp1": { "value": true },42                                "someProp2": { "value": "nasu" },43                                "someProp3": { "value": { "type": "undefined" } },44                                "someProp4": { "value": { "type": "null" } },45                                "someProp5": { "value": { "type": "object", "class": "Object" } } });46      localVar5.someProp5.addProperties({ "someProp0": { "value": 42 },47                                          "someProp1": { "value": true },48                                          "someProp2": { "value": "nasu" },49                                          "someProp3": { "value": { "type": "undefined" } },50                                          "someProp4": { "value": { "type": "null" } },51                                          "someAccessor": { "get": { "type": "object", "class": "Function" },52                                                            "set": { "type": "undefined" } } });53      windowVar.setGrip({ "type": "object", "class": "Window" });54      windowVar.addProperties({ "helloWorld": { "value": "hello world" } });55      documentVar.setGrip({ "type": "object", "class": "HTMLDocument" });56      documentVar.addProperties({ "onload": { "value": { "type": "null" } },57                                  "onunload": { "value": { "type": "null" } },58                                  "onfocus": { "value": { "type": "null" } },59                                  "onblur": { "value": { "type": "null" } },60                                  "onclick": { "value": { "type": "null" } },61                                  "onkeypress": { "value": { "type": "null" } } });62      ok(windowVar, "The windowVar hasn't been created correctly.");63      ok(documentVar, "The documentVar hasn't been created correctly.");64      ok(localVar0, "The localVar0 hasn't been created correctly.");65      ok(localVar1, "The localVar1 hasn't been created correctly.");66      ok(localVar2, "The localVar2 hasn't been created correctly.");67      ok(localVar3, "The localVar3 hasn't been created correctly.");68      ok(localVar4, "The localVar4 hasn't been created correctly.");69      ok(localVar5, "The localVar5 hasn't been created correctly.");70      for each (let elt in globalScope.querySelector(".details").childNodes) {71        info("globalScope :: " + {72          id: elt.id, className: elt.className }.toSource());73      }74      is(globalScope.querySelector(".details").childNodes.length, 2,75        "The globalScope doesn't contain all the created variable elements.");76      for each (let elt in localScope.querySelector(".details").childNodes) {77        info("localScope :: " + {78          id: elt.id, className: elt.className }.toSource());79      }80      is(localScope.querySelector(".details").childNodes.length, 6,81        "The localScope doesn't contain all the created variable elements.");82      is(localVar5.querySelector(".details").childNodes.length, 6,83        "The localVar5 doesn't contain all the created properties.");84      is(localVar5.someProp5.querySelector(".details").childNodes.length, 6,85        "The localVar5.someProp5 doesn't contain all the created properties.");86      is(windowVar.querySelector(".value").getAttribute("value"), "[object Window]",87        "The grip information for the windowVar wasn't set correctly.");88      is(documentVar.querySelector(".value").getAttribute("value"), "[object HTMLDocument]",89        "The grip information for the documentVar wasn't set correctly.");90      is(localVar0.querySelector(".value").getAttribute("value"), "42",91        "The grip information for the localVar0 wasn't set correctly.");92      is(localVar1.querySelector(".value").getAttribute("value"), "true",93        "The grip information for the localVar1 wasn't set correctly.");94      is(localVar2.querySelector(".value").getAttribute("value"), "\"nasu\"",95        "The grip information for the localVar2 wasn't set correctly.");96      is(localVar3.querySelector(".value").getAttribute("value"), "undefined",97        "The grip information for the localVar3 wasn't set correctly.");98      is(localVar4.querySelector(".value").getAttribute("value"), "null",99        "The grip information for the localVar4 wasn't set correctly.");100      is(localVar5.querySelector(".value").getAttribute("value"), "[object Object]",101        "The grip information for the localVar5 wasn't set correctly.");102      gDebugger.DebuggerController.activeThread.resume(function() {103        closeDebuggerAndFinish();104      });105    }}, 0);106  });107  gDebuggee.simpleCall();108}109registerCleanupFunction(function() {110  removeTab(gTab);111  gPane = null;112  gTab = null;113  gDebuggee = null;114  gDebugger = null;...test_threading_local.py
Source:test_threading_local.py  
...18        self._local_refs(20)19        self._local_refs(50)20        self._local_refs(100)21    def _local_refs(self, n):22        local = self._local()23        weaklist = []24        for i in range(n):25            t = threading.Thread(target=target, args=(local, weaklist))26            t.start()27            t.join()28        del t29        gc.collect()30        self.assertEqual(len(weaklist), n)31        # XXX _threading_local keeps the local of the last stopped thread alive.32        deadlist = [weak for weak in weaklist if weak() is None]33        self.assertIn(len(deadlist), (n-1, n))34        # Assignment to the same thread local frees it sometimes (!)35        local.someothervar = None36        gc.collect()37        deadlist = [weak for weak in weaklist if weak() is None]38        self.assertIn(len(deadlist), (n-1, n), (n, len(deadlist)))39    def test_derived(self):40        # Issue 3088: if there is a threads switch inside the __init__41        # of a threading.local derived class, the per-thread dictionary42        # is created but not correctly set on the object.43        # The first member set may be bogus.44        import time45        class Local(self._local):46            def __init__(self):47                time.sleep(0.01)48        local = Local()49        def f(i):50            local.x = i51            # Simply check that the variable is correctly set52            self.assertEqual(local.x, i)53        with support.start_threads(threading.Thread(target=f, args=(i,))54                                   for i in range(10)):55            pass56    def test_derived_cycle_dealloc(self):57        # http://bugs.python.org/issue699058        class Local(self._local):59            pass60        locals = None61        passed = False62        e1 = threading.Event()63        e2 = threading.Event()64        def f():65            nonlocal passed66            # 1) Involve Local in a cycle67            cycle = [Local()]68            cycle.append(cycle)69            cycle[0].foo = 'bar'70            # 2) GC the cycle (triggers threadmodule.c::local_clear71            # before local_dealloc)72            del cycle73            gc.collect()74            e1.set()75            e2.wait()76            # 4) New Locals should be empty77            passed = all(not hasattr(local, 'foo') for local in locals)78        t = threading.Thread(target=f)79        t.start()80        e1.wait()81        # 3) New Locals should recycle the original's address. Creating82        # them in the thread overwrites the thread state and avoids the83        # bug84        locals = [Local() for i in range(10)]85        e2.set()86        t.join()87        self.assertTrue(passed)88    def test_arguments(self):89        # Issue 152223790        class MyLocal(self._local):91            def __init__(self, *args, **kwargs):92                pass93        MyLocal(a=1)94        MyLocal(1)95        self.assertRaises(TypeError, self._local, a=1)96        self.assertRaises(TypeError, self._local, 1)97    def _test_one_class(self, c):98        self._failed = "No error message set or cleared."99        obj = c()100        e1 = threading.Event()101        e2 = threading.Event()102        def f1():103            obj.x = 'foo'104            obj.y = 'bar'105            del obj.y106            e1.set()107            e2.wait()108        def f2():109            try:110                foo = obj.x111            except AttributeError:112                # This is expected -- we haven't set obj.x in this thread yet!113                self._failed = ""  # passed114            else:115                self._failed = ('Incorrectly got value %r from class %r\n' %116                                (foo, c))117                sys.stderr.write(self._failed)118        t1 = threading.Thread(target=f1)119        t1.start()120        e1.wait()121        t2 = threading.Thread(target=f2)122        t2.start()123        t2.join()124        # The test is done; just let t1 know it can exit, and wait for it.125        e2.set()126        t1.join()127        self.assertFalse(self._failed, self._failed)128    def test_threading_local(self):129        self._test_one_class(self._local)130    def test_threading_local_subclass(self):131        class LocalSubclass(self._local):132            """To test that subclasses behave properly."""133        self._test_one_class(LocalSubclass)134    def _test_dict_attribute(self, cls):135        obj = cls()136        obj.x = 5137        self.assertEqual(obj.__dict__, {'x': 5})138        with self.assertRaises(AttributeError):139            obj.__dict__ = {}140        with self.assertRaises(AttributeError):141            del obj.__dict__142    def test_dict_attribute(self):143        self._test_dict_attribute(self._local)144    def test_dict_attribute_subclass(self):145        class LocalSubclass(self._local):146            """To test that subclasses behave properly."""147        self._test_dict_attribute(LocalSubclass)148    def test_cycle_collection(self):149        class X:150            pass151        x = X()152        x.local = self._local()153        x.local.x = x154        wr = weakref.ref(x)155        del x156        gc.collect()157        self.assertIsNone(wr())158class ThreadLocalTest(unittest.TestCase, BaseLocalTest):159    _local = _thread._local160class PyThreadingLocalTest(unittest.TestCase, BaseLocalTest):161    _local = _threading_local.local162def test_main():163    suite = unittest.TestSuite()164    suite.addTest(DocTestSuite('_threading_local'))165    suite.addTest(unittest.makeSuite(ThreadLocalTest))166    suite.addTest(unittest.makeSuite(PyThreadingLocalTest))...jumin.js
Source:jumin.js  
1/**2 * 3 */4/*í´ëì¤ì¤ê³*/5//      í´ëì¤ëª
6function Jumin(jumin_no)7{8	//Member Field(ë³ì)9	this.jumin_no = jumin_no;10	//Member Function(í¨ì)11	this.getYear = function(){12		13		var str_year = this.jumin_no.substring(0,0+2);14		var year     = parseInt(str_year);// 9015		var gender   = this.jumin_no.substring(7,7+1);16		if(gender=='1' || gender=='2' || gender=='5' ||gender=='6')17			  year += 1900;18		else 19			  year += 2000;20		21		return year;22	}23	24	this.getAge = function(){25		26		var today = new Date();//íì¬ìì¤í
ë ì§27		var current_year = today.getFullYear();//28		var age = current_year - this.getYear() + 1;29		return age;30	}31	32	this.getTti = function(){33		34		var tti_array = ['ììì´','ë','ê°','ë¼ì§','ì¥','ì','í¸ëì´','í ë¼','ì©','ë±','ë§','ì'];35		var tti_index = this.getYear()%12;36		37		return tti_array[tti_index];38	}39	40	this.getGender = function(){41		42		var gender = this.jumin_no.substring(7,8);43		if(gender=='1' || gender=='3' || 44		   gender=='5' || gender=='7')45		   return "ë¨ì";46		47		return "ì¬ì";48	}49	50	51	this.getLocal = function(){52		53		var local_code = parseInt(this.jumin_no.substring(8,10));54		55		if(local_code>=0 && local_code<=8) return "ìì¸";56		else if(local_code>=9 && local_code<=12) return "ë¶ì°";57		else if(local_code>=13 && local_code<=15) return "ì¸ì²";58		else if(local_code>=16 && local_code<=25) return "경기ë";59		else if(local_code>=26 && local_code<=34) return "ê°ìë";60		else if(local_code>=35 && local_code<=39) return "ì¶©ì²ë¶ë";61		else if(local_code==40) return "ëì ";62		else if(local_code>=41 && local_code<=47) return "ì¶©ì²ë¨ë";63		else if(local_code==44 || local_code==49) return "ì¸ì¢
ì";64		else if(local_code>=48 && local_code<=54) return "ì ë¼ë¶ë";65		else if(local_code>=55 && local_code<=56) return "ê´ì£¼";66		else if(local_code>=57 && local_code<=64) return "ì ë¼ë¨ë";67		else if(local_code>=70 && local_code<=7568				|| local_code>=77 && local_code<=8169		          ) return "ê²½ìë¶ë";70		else if(local_code>=82 && local_code<=8471				|| local_code>=86 && local_code<=9272		          ) return "ê²½ìë¶ë";73		else if(local_code==85) return "ì¸ì°";74		else if(local_code>=93 && local_code<=95) return "ê²½ìë¶ë";75		76		return "기í";77	}...LocalStore.js
Source:LocalStore.js  
1/**2 * Olives http://flams.github.com/olives3 * The MIT License (MIT)4 * Copyright (c) 2012-2013 Olivier Scherrer <pode.fr@gmail.com> - Olivier Wietrich <olivier.wietrich@gmail.com>5 */6define(["Store", "Tools"],7/**8 * @class9 * LocalStore is an Emily's Store that can be synchronized with localStorage10 * Synchronize the store, reload your page/browser and resynchronize it with the same value11 * and it gets restored.12 * Only valid JSON data will be stored13 */14function LocalStore(Store, Tools) {15	function LocalStoreConstructor() {16		/**17		 * The name of the property in which to store the data18		 * @private19		 */20		var _name = null,21		/**22		 * The localStorage23		 * @private24		 */25		_localStorage = localStorage,26		/**27		 * Saves the current values in localStorage28		 * @private29		 */30		setLocalStorage = function setLocalStorage() {31			_localStorage.setItem(_name, this.toJSON());32		};33		/**34		 * Override default localStorage with a new one35		 * @param local$torage the new localStorage36		 * @returns {Boolean} true if success37		 * @private38		 */39		this.setLocalStorage = function setLocalStorage(local$torage) {40			if (local$torage && local$torage.setItem instanceof Function) {41				_localStorage = local$torage;42				return true;43			} else {44				return false;45			}46		};47		/**48		 * Get the current localStorage49		 * @returns localStorage50		 * @private51		 */52		this.getLocalStorage = function getLocalStorage() {53			return _localStorage;54		};55		/**56		 * Synchronize the store with localStorage57		 * @param {String} name the name in which to save the data58		 * @returns {Boolean} true if the param is a string59		 */60		this.sync = function sync(name) {61			var json;62			if (typeof name == "string") {63				_name = name;64				json = JSON.parse(_localStorage.getItem(name));65				Tools.loop(json, function (value, idx) {66					if (!this.has(idx)) {67						this.set(idx, value);68					}69				}, this);70				setLocalStorage.call(this);71				// Watch for modifications to update localStorage72				this.watch("added", setLocalStorage, this);73				this.watch("updated", setLocalStorage, this);74				this.watch("deleted", setLocalStorage, this);75				return true;76			} else {77				return false;78			}79		};80	}81	return function LocalStoreFactory(init) {82		LocalStoreConstructor.prototype = new Store(init);83		return new LocalStoreConstructor;84	};...Using AI Code Generation
1import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';2import { MockBuilder, MockRender, ngMocks } from 'ng-mocks/dist/ng-mocks';3import 'ng-mocks/dist/ng-mocks';4import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';5import { MockBuilder, MockRender, ngMocks } from 'ng-mocks/dist/ng-mocks';6import 'ng-mocks/dist/ng-mocks';7import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';8import { MockBuilder, MockRender, ngMocks } from 'ng-mocks/dist/ng-mocks';9import 'ng-mocks/dist/ng-mocks';10import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';11import { MockBuilder, MockRender, ngMocks } from 'ng-mocks/dist/ng-mocks';12import 'ng-mocks/dist/ng-mocks';13import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';14import { MockBuilder, MockRender, ngMocks } from 'ng-mocks/dist/ng-mocks';15import 'ng-mocks/dist/ng-mocks';16import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';17import { MockBuilder, MockRender, ngMocks } from 'ng-mocks/dist/ng-mocks';Using AI Code Generation
1import { MockBuilder, MockRender } from 'ng-mocks';2import { AppComponent } from './app.component';3import { AppModule } from './app.module';4describe('AppComponent', () => {5  beforeEach(() => MockBuilder(AppComponent, AppModule));6  it('should create the app', () => {7    const fixture = MockRender(AppComponent);8    const app = fixture.debugElement.componentInstance;9    expect(app).toBeTruthy();10  });11  it(`should have as title 'ng-mocks'`, () => {12    const fixture = MockRender(AppComponent);13    const app = fixture.debugElement.componentInstance;14    expect(app.title).toEqual('ng-mocks');15  });16  it('should render title', () => {17    const fixture = MockRender(AppComponent);18    fixture.detectChanges();19    const compiled = fixture.debugElement.nativeElement;20    expect(compiled.querySelector('h1').textContent).toContain('Welcome to ng-mocks!');21  });22});Using AI Code Generation
1import { ngMocks } from 'ng-mocks';2import { AppComponent } from './app.component';3import { AppModule } from './app.module';4describe('AppComponent', () => {5  beforeEach(() => {6    ngMocks.faster();7    ngMocks.guts(AppModule, AppComponent);8  });9  it('should create the app', () => {10    const fixture = ngMocks.find(AppComponent);11    const app = fixture.componentInstance;12    expect(app).toBeTruthy();13  });14  it(`should have as title 'ng-mocks'`, () => {15    const fixture = ngMocks.find(AppComponent);16    const app = fixture.componentInstance;17    expect(app.title).toEqual('ng-mocks');18  });19  it('should render title', () => {20    const fixture = ngMocks.find(AppComponent);21    fixture.detectChanges();22    const compiled = fixture.nativeElement;23    expect(compiled.querySelector('.content span').textContent).toContain(24    );25  });26});27import 'ng-mocks';28import './test.js';Using AI Code Generation
1import { MockBuilder, MockRender, ngMocks } from 'ng-mocks';2import { AppModule } from './app.module';3import { AppComponent } from './app.component';4import { TestComponent } from './test/test.component';5import { By } from '@angular/platform-browser';6import { TestService } from './test.service';7import { of } from 'rxjs';8import { FormsModule } from '@angular/forms';9describe('AppComponent', () => {10  beforeEach(() => MockBuilder(AppComponent, AppModule).mock(FormsModule));11  it('should create the app', () => {12    const fixture = MockRender(AppComponent);13    const app = fixture.point.componentInstance;14    expect(app).toBeTruthy();15  });16  it('should have a title', () => {17    const fixture = MockRender(AppComponent);18    const app = fixture.point.componentInstance;19    expect(app.title).toEqual('ng-mocks');20  });21  it('should render title', () => {22    const fixture = MockRender(AppComponent);23    const compiled = fixture.point.nativeElement as HTMLElement;24    expect(compiled.querySelector('h1')?.textContent).toContain(25    );26  });27  it('should render test component', () => {28    const fixture = MockRender(AppComponent);29    const compiled = fixture.point.nativeElement as HTMLElement;30    expect(compiled.querySelector('app-test')).toBeTruthy();31  });32  it('should render test component with mocked service', () => {33    const fixture = MockRender(AppComponent);34    const compiled = fixture.point.nativeElement as HTMLElement;35    const testService = ngMocks.findInstance(TestService);36    const spy = spyOn(testService, 'getData').and.returnValue(of('test'));37    fixture.detectChanges();38    expect(compiled.querySelector('app-test')).toBeTruthy();39    expect(compiled.querySelector('app-test h2')?.textContent).toContain(40    );41  });42  it('should render test component with mocked service and change data', () => {43    const fixture = MockRender(AppComponent);44    const compiled = fixture.point.nativeElement as HTMLElement;45    const testService = ngMocks.findInstance(TestService);46    const spy = spyOn(testService, 'getData').and.returnValue(of('test'));47    fixture.detectChanges();48    const input = compiled.querySelector('input') as HTMLInputElement;49    input.value = 'test2';50    input.dispatchEvent(new Event('input'));Using AI Code Generation
1import { TestBed } from '@angular/core/testing';2import { MockBuilder, MockRender } from 'ng-mocks';3import { AppComponent } from './app.component';4describe('AppComponent', () => {5  beforeEach(() => MockBuilder(AppComponent));6  it('should create the app', () => {7    const fixture = MockRender(AppComponent);8    const app = fixture.point.componentInstance;9    expect(app).toBeTruthy();10  });11  it(`should have as title 'ng-mocks'`, () => {12    const fixture = MockRender(AppComponent);13    const app = fixture.point.componentInstance;14    expect(app.title).toEqual('ng-mocks');15  });16  it('should render title', () => {17    const fixture = MockRender(AppComponent);18    fixture.point.detectChanges();19    const compiled = fixture.debugElement.nativeElement;20    expect(compiled.querySelector('.content span').textContent).toContain(21    );22  });23});24import 'zone.js/dist/zone-testing';25import { getTestBed } from '@angular/core/testing';26import {27} from '@angular/platform-browser-dynamic/testing';28declare const require: any;29getTestBed().initTestEnvironment(30  platformBrowserDynamicTesting(),31);32const context = require.context('./', true, /\.spec\.ts$/);33context.keys().map(context);34{35  "compilerOptions": {36  },37}38{39  "compilerOptions": {40  },41}Using AI Code Generation
1var ngMocks = require('ng-mocks');2describe('ng-mocks', function () {3  describe('ngMocks.defaultMock', function () {4    it('sets the default mock for a service', function () {5      var service = ngMocks.defaultMock(MyService, {6        myMethod: function myMethod() {7          return 'mocked value';8        }9      });10      var fixture = ngMocks.defaultMock(MyService, {11        myMethod: function myMethod() {12          return 'mocked value';13        }14      });15      var result = fixture.myMethod();16      expect(result).toEqual('mocked value');17    });18    it('sets the default mock for a service', function () {19      var service = ngMocks.defaultMock(MyService, {20        myMethod: function myMethod() {21          return 'mocked value';22        }23      });24      var fixture = ngMocks.defaultMock(MyService, {25        myMethod: function myMethod() {26          return 'mocked value';27        }28      });29      var result = fixture.myMethod();Using AI Code Generation
1import { MockBuilder, MockRender } from 'ng-mocks';2import { AppComponent } from './app.component';3import { AppModule } from './app.module';4import { DataService } from './data.service';5import { Todo } from './todo';6describe('AppComponent', () => {7  beforeEach(() => MockBuilder(AppComponent, AppModule));8  it('should create the app', () => {9    const fixture = MockRender(AppComponent);10    const app = fixture.point.componentInstance;11    expect(app).toBeTruthy();12  });13  it('should render title in a h1 tag', () => {14    const fixture = MockRender(AppComponent);15    expect(fixture.point.nativeElement.querySelector('h1').textContent).toContain(16    );17  });18  it('should render a list of todos', () => {19    const fixture = MockRender(AppComponent);20    expect(fixture.point.nativeElement.querySelectorAll('li').length).toBe(3);21  });22  it('should render a list of todos with the correct text', () => {23    const fixture = MockRender(AppComponent);24    const todos = fixture.debugElement.nativeElement.querySelectorAll('li');25    expect(todos[0].textContent).toContain('Walk the dog');26    expect(todos[1].textContent).toContain('Clean the house');27    expect(todos[2].textContent).toContain('Wash the car');28  });29  it('should render a list of todos with the correct text using ngMocks', () => {30  });31  it('should render a list of todos with the correct text using ngMocks and a custom matcher', () => {32  });33  it('shouldUsing AI Code Generation
1import 'ng-mocks';2describe('MyComponent', () => {3  beforeEach(() => {4    TestBed.configureTestingModule({5      imports: [MyModule],6    });7  });8  it('should work', () => {9    const fixture = TestBed.createComponent(MyComponent);10    fixture.detectChanges();11    expect(fixture.nativeElement).toMatchSnapshot();12  });13});14import 'ng-mocks-universal';15describe('MyComponent', () => {16  beforeEach(() => {17    TestBed.configureTestingModule({});18  });19  it('should work', () => {20    const fixture = TestBed.createComponent(MyComponent);21    fixture.detectChanges();22    expect(fixture.nativeElement).toMatchSnapshot();23  });24});25import 'ng-mocks-td';26describe('MyComponent', () => {27  beforeEach(() => {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!!
