Best JavaScript code snippet using chai
BUILD
Source:BUILD  
1# A build file to configure python remote repository used with Bazel remote2# execution service3# DO NOT EDIT: automatically generated BUILD file4licenses(["restricted"])5package(default_visibility = ["//visibility:public"])6cc_library(7    name = "python_headers",8    hdrs = [":python_include"],9    data = select({10        ":windows": [":python_import_lib"],11        "//conditions:default": [],12    }),13    includes = ["python_include"],14    linkopts = select({15        # TODO(pcloudy): Ideally, this should just go into deps after resolving16        # https://github.com/bazelbuild/bazel/issues/3237,17        ":windows": ["$(locations :python_import_lib)"],18        "//conditions:default": [],19    }),20)21cc_library(22    name = "numpy_headers",23    hdrs = [":numpy_include"],24    includes = ["numpy_include"],25)26config_setting(27    name = "windows",28    values = {"cpu": "x64_windows"},29    visibility = ["//visibility:public"],30)31genrule(32    name = "python_include",33    outs = [34        "python_include/code.h",35        "python_include/dtoa.h",36        "python_include/tupleobject.h",37        "python_include/object.h",38        "python_include/ast.h",39        "python_include/pymacconfig.h",40        "python_include/errcode.h",41        "python_include/frameobject.h",42        "python_include/pgenheaders.h",43        "python_include/cellobject.h",44        "python_include/intobject.h",45        "python_include/pythread.h",46        "python_include/cStringIO.h",47        "python_include/boolobject.h",48        "python_include/modsupport.h",49        "python_include/import.h",50        "python_include/pymath.h",51        "python_include/node.h",52        "python_include/funcobject.h",53        "python_include/eval.h",54        "python_include/longintrepr.h",55        "python_include/floatobject.h",56        "python_include/rangeobject.h",57        "python_include/pyfpe.h",58        "python_include/pystrcmp.h",59        "python_include/dictobject.h",60        "python_include/pyarena.h",61        "python_include/objimpl.h",62        "python_include/bitset.h",63        "python_include/memoryobject.h",64        "python_include/bytearrayobject.h",65        "python_include/pydebug.h",66        "python_include/pyerrors.h",67        "python_include/weakrefobject.h",68        "python_include/grammar.h",69        "python_include/symtable.h",70        "python_include/longobject.h",71        "python_include/structmember.h",72        "python_include/enumobject.h",73        "python_include/classobject.h",74        "python_include/unicodeobject.h",75        "python_include/sliceobject.h",76        "python_include/pystrtod.h",77        "python_include/genobject.h",78        "python_include/pymactoolbox.h",79        "python_include/compile.h",80        "python_include/pyexpat.h",81        "python_include/asdl.h",82        "python_include/codecs.h",83        "python_include/pyctype.h",84        "python_include/sysmodule.h",85        "python_include/methodobject.h",86        "python_include/graminit.h",87        "python_include/cobject.h",88        "python_include/intrcheck.h",89        "python_include/pyport.h",90        "python_include/warnings.h",91        "python_include/osdefs.h",92        "python_include/fileobject.h",93        "python_include/stringobject.h",94        "python_include/timefuncs.h",95        "python_include/traceback.h",96        "python_include/ceval.h",97        "python_include/bytes_methods.h",98        "python_include/pyconfig.h",99        "python_include/Python.h",100        "python_include/moduleobject.h",101        "python_include/pystate.h",102        "python_include/descrobject.h",103        "python_include/ucnhash.h",104        "python_include/pygetopt.h",105        "python_include/pymem.h",106        "python_include/complexobject.h",107        "python_include/structseq.h",108        "python_include/datetime.h",109        "python_include/pythonrun.h",110        "python_include/numpy/oldnumeric.h",111        "python_include/numpy/npy_1_7_deprecated_api.h",112        "python_include/numpy/ufunc_api.txt",113        "python_include/numpy/multiarray_api.txt",114        "python_include/numpy/halffloat.h",115        "python_include/numpy/npy_common.h",116        "python_include/numpy/utils.h",117        "python_include/numpy/npy_interrupt.h",118        "python_include/numpy/npy_endian.h",119        "python_include/numpy/__ufunc_api.h",120        "python_include/numpy/_neighborhood_iterator_imp.h",121        "python_include/numpy/ufuncobject.h",122        "python_include/numpy/ndarraytypes.h",123        "python_include/numpy/npy_math.h",124        "python_include/numpy/noprefix.h",125        "python_include/numpy/npy_3kcompat.h",126        "python_include/numpy/arrayscalars.h",127        "python_include/numpy/npy_os.h",128        "python_include/numpy/ndarrayobject.h",129        "python_include/numpy/npy_no_deprecated_api.h",130        "python_include/numpy/arrayobject.h",131        "python_include/numpy/_numpyconfig.h",132        "python_include/numpy/__multiarray_api.h",133        "python_include/numpy/npy_cpu.h",134        "python_include/numpy/old_defines.h",135        "python_include/numpy/numpyconfig.h",136        "python_include/pycapsule.h",137        "python_include/setobject.h",138        "python_include/listobject.h",139        "python_include/bytesobject.h",140        "python_include/pgen.h",141        "python_include/patchlevel.h",142        "python_include/opcode.h",143        "python_include/parsetok.h",144        "python_include/marshal.h",145        "python_include/token.h",146        "python_include/iterobject.h",147        "python_include/abstract.h",148        "python_include/py_curses.h",149        "python_include/metagrammar.h",150        "python_include/bufferobject.h",151        "python_include/Python-ast.h",152    ],153    cmd = """154cp "/usr/include/python2.7/code.h" "$(@D)/python_include/code.h" && cp "/usr/include/python2.7/dtoa.h" "$(@D)/python_include/dtoa.h" && cp "/usr/include/python2.7/tupleobject.h" "$(@D)/python_include/tupleobject.h" && cp "/usr/include/python2.7/object.h" "$(@D)/python_include/object.h" && cp "/usr/include/python2.7/ast.h" "$(@D)/python_include/ast.h" && cp "/usr/include/python2.7/pymacconfig.h" "$(@D)/python_include/pymacconfig.h" && cp "/usr/include/python2.7/errcode.h" "$(@D)/python_include/errcode.h" && cp "/usr/include/python2.7/frameobject.h" "$(@D)/python_include/frameobject.h" && cp "/usr/include/python2.7/pgenheaders.h" "$(@D)/python_include/pgenheaders.h" && cp "/usr/include/python2.7/cellobject.h" "$(@D)/python_include/cellobject.h" && cp "/usr/include/python2.7/intobject.h" "$(@D)/python_include/intobject.h" && cp "/usr/include/python2.7/pythread.h" "$(@D)/python_include/pythread.h" && cp "/usr/include/python2.7/cStringIO.h" "$(@D)/python_include/cStringIO.h" && cp "/usr/include/python2.7/boolobject.h" "$(@D)/python_include/boolobject.h" && cp "/usr/include/python2.7/modsupport.h" "$(@D)/python_include/modsupport.h" && cp "/usr/include/python2.7/import.h" "$(@D)/python_include/import.h" && cp "/usr/include/python2.7/pymath.h" "$(@D)/python_include/pymath.h" && cp "/usr/include/python2.7/node.h" "$(@D)/python_include/node.h" && cp "/usr/include/python2.7/funcobject.h" "$(@D)/python_include/funcobject.h" && cp "/usr/include/python2.7/eval.h" "$(@D)/python_include/eval.h" && cp "/usr/include/python2.7/longintrepr.h" "$(@D)/python_include/longintrepr.h" && cp "/usr/include/python2.7/floatobject.h" "$(@D)/python_include/floatobject.h" && cp "/usr/include/python2.7/rangeobject.h" "$(@D)/python_include/rangeobject.h" && cp "/usr/include/python2.7/pyfpe.h" "$(@D)/python_include/pyfpe.h" && cp "/usr/include/python2.7/pystrcmp.h" "$(@D)/python_include/pystrcmp.h" && cp "/usr/include/python2.7/dictobject.h" "$(@D)/python_include/dictobject.h" && cp "/usr/include/python2.7/pyarena.h" "$(@D)/python_include/pyarena.h" && cp "/usr/include/python2.7/objimpl.h" "$(@D)/python_include/objimpl.h" && cp "/usr/include/python2.7/bitset.h" "$(@D)/python_include/bitset.h" && cp "/usr/include/python2.7/memoryobject.h" "$(@D)/python_include/memoryobject.h" && cp "/usr/include/python2.7/bytearrayobject.h" "$(@D)/python_include/bytearrayobject.h" && cp "/usr/include/python2.7/pydebug.h" "$(@D)/python_include/pydebug.h" && cp "/usr/include/python2.7/pyerrors.h" "$(@D)/python_include/pyerrors.h" && cp "/usr/include/python2.7/weakrefobject.h" "$(@D)/python_include/weakrefobject.h" && cp "/usr/include/python2.7/grammar.h" "$(@D)/python_include/grammar.h" && cp "/usr/include/python2.7/symtable.h" "$(@D)/python_include/symtable.h" && cp "/usr/include/python2.7/longobject.h" "$(@D)/python_include/longobject.h" && cp "/usr/include/python2.7/structmember.h" "$(@D)/python_include/structmember.h" && cp "/usr/include/python2.7/enumobject.h" "$(@D)/python_include/enumobject.h" && cp "/usr/include/python2.7/classobject.h" "$(@D)/python_include/classobject.h" && cp "/usr/include/python2.7/unicodeobject.h" "$(@D)/python_include/unicodeobject.h" && cp "/usr/include/python2.7/sliceobject.h" "$(@D)/python_include/sliceobject.h" && cp "/usr/include/python2.7/pystrtod.h" "$(@D)/python_include/pystrtod.h" && cp "/usr/include/python2.7/genobject.h" "$(@D)/python_include/genobject.h" && cp "/usr/include/python2.7/pymactoolbox.h" "$(@D)/python_include/pymactoolbox.h" && cp "/usr/include/python2.7/compile.h" "$(@D)/python_include/compile.h" && cp "/usr/include/python2.7/pyexpat.h" "$(@D)/python_include/pyexpat.h" && cp "/usr/include/python2.7/asdl.h" "$(@D)/python_include/asdl.h" && cp "/usr/include/python2.7/codecs.h" "$(@D)/python_include/codecs.h" && cp "/usr/include/python2.7/pyctype.h" "$(@D)/python_include/pyctype.h" && cp "/usr/include/python2.7/sysmodule.h" "$(@D)/python_include/sysmodule.h" && cp "/usr/include/python2.7/methodobject.h" "$(@D)/python_include/methodobject.h" && cp "/usr/include/python2.7/graminit.h" "$(@D)/python_include/graminit.h" && cp "/usr/include/python2.7/cobject.h" "$(@D)/python_include/cobject.h" && cp "/usr/include/python2.7/intrcheck.h" "$(@D)/python_include/intrcheck.h" && cp "/usr/include/python2.7/pyport.h" "$(@D)/python_include/pyport.h" && cp "/usr/include/python2.7/warnings.h" "$(@D)/python_include/warnings.h" && cp "/usr/include/python2.7/osdefs.h" "$(@D)/python_include/osdefs.h" && cp "/usr/include/python2.7/fileobject.h" "$(@D)/python_include/fileobject.h" && cp "/usr/include/python2.7/stringobject.h" "$(@D)/python_include/stringobject.h" && cp "/usr/include/python2.7/timefuncs.h" "$(@D)/python_include/timefuncs.h" && cp "/usr/include/python2.7/traceback.h" "$(@D)/python_include/traceback.h" && cp "/usr/include/python2.7/ceval.h" "$(@D)/python_include/ceval.h" && cp "/usr/include/python2.7/bytes_methods.h" "$(@D)/python_include/bytes_methods.h" && cp "/usr/include/python2.7/pyconfig.h" "$(@D)/python_include/pyconfig.h" && cp "/usr/include/python2.7/Python.h" "$(@D)/python_include/Python.h" && cp "/usr/include/python2.7/moduleobject.h" "$(@D)/python_include/moduleobject.h" && cp "/usr/include/python2.7/pystate.h" "$(@D)/python_include/pystate.h" && cp "/usr/include/python2.7/descrobject.h" "$(@D)/python_include/descrobject.h" && cp "/usr/include/python2.7/ucnhash.h" "$(@D)/python_include/ucnhash.h" && cp "/usr/include/python2.7/pygetopt.h" "$(@D)/python_include/pygetopt.h" && cp "/usr/include/python2.7/pymem.h" "$(@D)/python_include/pymem.h" && cp "/usr/include/python2.7/complexobject.h" "$(@D)/python_include/complexobject.h" && cp "/usr/include/python2.7/structseq.h" "$(@D)/python_include/structseq.h" && cp "/usr/include/python2.7/datetime.h" "$(@D)/python_include/datetime.h" && cp "/usr/include/python2.7/pythonrun.h" "$(@D)/python_include/pythonrun.h" && cp "/usr/include/python2.7/numpy/oldnumeric.h" "$(@D)/python_include/numpy/oldnumeric.h" && cp "/usr/include/python2.7/numpy/npy_1_7_deprecated_api.h" "$(@D)/python_include/numpy/npy_1_7_deprecated_api.h" && cp "/usr/include/python2.7/numpy/ufunc_api.txt" "$(@D)/python_include/numpy/ufunc_api.txt" && cp "/usr/include/python2.7/numpy/multiarray_api.txt" "$(@D)/python_include/numpy/multiarray_api.txt" && cp "/usr/include/python2.7/numpy/halffloat.h" "$(@D)/python_include/numpy/halffloat.h" && cp "/usr/include/python2.7/numpy/npy_common.h" "$(@D)/python_include/numpy/npy_common.h" && cp "/usr/include/python2.7/numpy/utils.h" "$(@D)/python_include/numpy/utils.h" && cp "/usr/include/python2.7/numpy/npy_interrupt.h" "$(@D)/python_include/numpy/npy_interrupt.h" && cp "/usr/include/python2.7/numpy/npy_endian.h" "$(@D)/python_include/numpy/npy_endian.h" && cp "/usr/include/python2.7/numpy/__ufunc_api.h" "$(@D)/python_include/numpy/__ufunc_api.h" && cp "/usr/include/python2.7/numpy/_neighborhood_iterator_imp.h" "$(@D)/python_include/numpy/_neighborhood_iterator_imp.h" && cp "/usr/include/python2.7/numpy/ufuncobject.h" "$(@D)/python_include/numpy/ufuncobject.h" && cp "/usr/include/python2.7/numpy/ndarraytypes.h" "$(@D)/python_include/numpy/ndarraytypes.h" && cp "/usr/include/python2.7/numpy/npy_math.h" "$(@D)/python_include/numpy/npy_math.h" && cp "/usr/include/python2.7/numpy/noprefix.h" "$(@D)/python_include/numpy/noprefix.h" && cp "/usr/include/python2.7/numpy/npy_3kcompat.h" "$(@D)/python_include/numpy/npy_3kcompat.h" && cp "/usr/include/python2.7/numpy/arrayscalars.h" "$(@D)/python_include/numpy/arrayscalars.h" && cp "/usr/include/python2.7/numpy/npy_os.h" "$(@D)/python_include/numpy/npy_os.h" && cp "/usr/include/python2.7/numpy/ndarrayobject.h" "$(@D)/python_include/numpy/ndarrayobject.h" && cp "/usr/include/python2.7/numpy/npy_no_deprecated_api.h" "$(@D)/python_include/numpy/npy_no_deprecated_api.h" && cp "/usr/include/python2.7/numpy/arrayobject.h" "$(@D)/python_include/numpy/arrayobject.h" && cp "/usr/include/python2.7/numpy/_numpyconfig.h" "$(@D)/python_include/numpy/_numpyconfig.h" && cp "/usr/include/python2.7/numpy/__multiarray_api.h" "$(@D)/python_include/numpy/__multiarray_api.h" && cp "/usr/include/python2.7/numpy/npy_cpu.h" "$(@D)/python_include/numpy/npy_cpu.h" && cp "/usr/include/python2.7/numpy/old_defines.h" "$(@D)/python_include/numpy/old_defines.h" && cp "/usr/include/python2.7/numpy/numpyconfig.h" "$(@D)/python_include/numpy/numpyconfig.h" && cp "/usr/include/python2.7/pycapsule.h" "$(@D)/python_include/pycapsule.h" && cp "/usr/include/python2.7/setobject.h" "$(@D)/python_include/setobject.h" && cp "/usr/include/python2.7/listobject.h" "$(@D)/python_include/listobject.h" && cp "/usr/include/python2.7/bytesobject.h" "$(@D)/python_include/bytesobject.h" && cp "/usr/include/python2.7/pgen.h" "$(@D)/python_include/pgen.h" && cp "/usr/include/python2.7/patchlevel.h" "$(@D)/python_include/patchlevel.h" && cp "/usr/include/python2.7/opcode.h" "$(@D)/python_include/opcode.h" && cp "/usr/include/python2.7/parsetok.h" "$(@D)/python_include/parsetok.h" && cp "/usr/include/python2.7/marshal.h" "$(@D)/python_include/marshal.h" && cp "/usr/include/python2.7/token.h" "$(@D)/python_include/token.h" && cp "/usr/include/python2.7/iterobject.h" "$(@D)/python_include/iterobject.h" && cp "/usr/include/python2.7/abstract.h" "$(@D)/python_include/abstract.h" && cp "/usr/include/python2.7/py_curses.h" "$(@D)/python_include/py_curses.h" && cp "/usr/include/python2.7/metagrammar.h" "$(@D)/python_include/metagrammar.h" && cp "/usr/include/python2.7/bufferobject.h" "$(@D)/python_include/bufferobject.h" && cp "/usr/include/python2.7/Python-ast.h" "$(@D)/python_include/Python-ast.h"155   """,156)157genrule(158    name = "numpy_include",159    outs = [160        "numpy_include/numpy/oldnumeric.h",161        "numpy_include/numpy/npy_1_7_deprecated_api.h",162        "numpy_include/numpy/ufunc_api.txt",163        "numpy_include/numpy/multiarray_api.txt",164        "numpy_include/numpy/halffloat.h",165        "numpy_include/numpy/npy_common.h",166        "numpy_include/numpy/utils.h",167        "numpy_include/numpy/npy_interrupt.h",168        "numpy_include/numpy/npy_endian.h",169        "numpy_include/numpy/__ufunc_api.h",170        "numpy_include/numpy/_neighborhood_iterator_imp.h",171        "numpy_include/numpy/ufuncobject.h",172        "numpy_include/numpy/ndarraytypes.h",173        "numpy_include/numpy/npy_math.h",174        "numpy_include/numpy/noprefix.h",175        "numpy_include/numpy/npy_3kcompat.h",176        "numpy_include/numpy/arrayscalars.h",177        "numpy_include/numpy/npy_os.h",178        "numpy_include/numpy/ndarrayobject.h",179        "numpy_include/numpy/npy_no_deprecated_api.h",180        "numpy_include/numpy/arrayobject.h",181        "numpy_include/numpy/_numpyconfig.h",182        "numpy_include/numpy/__multiarray_api.h",183        "numpy_include/numpy/npy_cpu.h",184        "numpy_include/numpy/old_defines.h",185        "numpy_include/numpy/numpyconfig.h",186    ],187    cmd = """188cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/oldnumeric.h" "$(@D)/numpy_include/numpy/oldnumeric.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_1_7_deprecated_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufunc_api.txt" "$(@D)/numpy_include/numpy/ufunc_api.txt" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/multiarray_api.txt" "$(@D)/numpy_include/numpy/multiarray_api.txt" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/halffloat.h" "$(@D)/numpy_include/numpy/halffloat.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_common.h" "$(@D)/numpy_include/numpy/npy_common.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/utils.h" "$(@D)/numpy_include/numpy/utils.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_interrupt.h" "$(@D)/numpy_include/numpy/npy_interrupt.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_endian.h" "$(@D)/numpy_include/numpy/npy_endian.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h" "$(@D)/numpy_include/numpy/__ufunc_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/_neighborhood_iterator_imp.h" "$(@D)/numpy_include/numpy/_neighborhood_iterator_imp.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h" "$(@D)/numpy_include/numpy/ufuncobject.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h" "$(@D)/numpy_include/numpy/ndarraytypes.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_math.h" "$(@D)/numpy_include/numpy/npy_math.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/noprefix.h" "$(@D)/numpy_include/numpy/noprefix.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_3kcompat.h" "$(@D)/numpy_include/numpy/npy_3kcompat.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayscalars.h" "$(@D)/numpy_include/numpy/arrayscalars.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_os.h" "$(@D)/numpy_include/numpy/npy_os.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h" "$(@D)/numpy_include/numpy/ndarrayobject.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_no_deprecated_api.h" "$(@D)/numpy_include/numpy/npy_no_deprecated_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h" "$(@D)/numpy_include/numpy/arrayobject.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/_numpyconfig.h" "$(@D)/numpy_include/numpy/_numpyconfig.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__multiarray_api.h" "$(@D)/numpy_include/numpy/__multiarray_api.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_cpu.h" "$(@D)/numpy_include/numpy/npy_cpu.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/old_defines.h" "$(@D)/numpy_include/numpy/old_defines.h" && cp "/usr/lib/python2.7/dist-packages/numpy/core/include/numpy/numpyconfig.h" "$(@D)/numpy_include/numpy/numpyconfig.h"189   """,...AmpCustomElement.js
Source:AmpCustomElement.js  
1/**2 * @file An AMP Component import helper. This file is auto-generated using3 * https://www.npmjs.com/package/@ampproject/toolbox-validator-rules.4 */5import React from 'react'6import Head from 'next/head'7export function AmpIncludeCustomElement(props) {8  return (9    <Head>10      <script11        async12        custom-element={props.name}13        src={14          'https://cdn.ampproject.org/v0/' +15          props.name +16          '-' +17          props.version +18          '.js'19        }20        key={props.name}21      />22    </Head>23  )24}25export function AmpIncludeCustomTemplate(props) {26  return (27    <Head>28      <script29        async30        custom-template={props.name}31        src={32          'https://cdn.ampproject.org/v0/' +33          props.name +34          '-' +35          props.version +36          '.js'37        }38        key={props.name}39      />40    </Head>41  )42}43export function AmpIncludeAmp3dGltf() {44  return <AmpIncludeCustomElement name="amp-3d-gltf" version="0.1" />45}46export function AmpIncludeAmp3qPlayer() {47  return <AmpIncludeCustomElement name="amp-3q-player" version="0.1" />48}49export function AmpIncludeAmpAccessLaterpay() {50  return <AmpIncludeCustomElement name="amp-access-laterpay" version="0.2" />51}52export function AmpIncludeAmpAccessPoool() {53  return <AmpIncludeCustomElement name="amp-access-poool" version="0.1" />54}55export function AmpIncludeAmpAccessScroll() {56  return <AmpIncludeCustomElement name="amp-access-scroll" version="0.1" />57}58export function AmpIncludeAmpAccess() {59  return <AmpIncludeCustomElement name="amp-access" version="0.1" />60}61export function AmpIncludeAmpAccordion() {62  return <AmpIncludeCustomElement name="amp-accordion" version="0.1" />63}64export function AmpIncludeAmpActionMacro() {65  return <AmpIncludeCustomElement name="amp-action-macro" version="0.1" />66}67export function AmpIncludeAmpAdCustom() {68  return <AmpIncludeCustomElement name="amp-ad-custom" version="0.1" />69}70export function AmpIncludeAmpAd() {71  return <AmpIncludeCustomElement name="amp-ad" version="0.1" />72}73export function AmpIncludeAmpAddthis() {74  return <AmpIncludeCustomElement name="amp-addthis" version="0.1" />75}76export function AmpIncludeAmpAnalytics() {77  return <AmpIncludeCustomElement name="amp-analytics" version="0.1" />78}79export function AmpIncludeAmpAnim() {80  return <AmpIncludeCustomElement name="amp-anim" version="0.1" />81}82export function AmpIncludeAmpAnimation() {83  return <AmpIncludeCustomElement name="amp-animation" version="0.1" />84}85export function AmpIncludeAmpApesterMedia() {86  return <AmpIncludeCustomElement name="amp-apester-media" version="0.1" />87}88export function AmpIncludeAmpAppBanner() {89  return <AmpIncludeCustomElement name="amp-app-banner" version="0.1" />90}91export function AmpIncludeAmpAudio() {92  return <AmpIncludeCustomElement name="amp-audio" version="0.1" />93}94export function AmpIncludeAmpAutoAds() {95  return <AmpIncludeCustomElement name="amp-auto-ads" version="0.1" />96}97export function AmpIncludeAmpAutocomplete() {98  return <AmpIncludeCustomElement name="amp-autocomplete" version="0.1" />99}100export function AmpIncludeAmpBaseCarousel() {101  return <AmpIncludeCustomElement name="amp-base-carousel" version="0.1" />102}103export function AmpIncludeAmpBeopinion() {104  return <AmpIncludeCustomElement name="amp-beopinion" version="0.1" />105}106export function AmpIncludeAmpBind() {107  return <AmpIncludeCustomElement name="amp-bind" version="0.1" />108}109export function AmpIncludeAmpBodymovinAnimation() {110  return (111    <AmpIncludeCustomElement name="amp-bodymovin-animation" version="0.1" />112  )113}114export function AmpIncludeAmpBridPlayer() {115  return <AmpIncludeCustomElement name="amp-brid-player" version="0.1" />116}117export function AmpIncludeAmpBrightcove() {118  return <AmpIncludeCustomElement name="amp-brightcove" version="0.1" />119}120export function AmpIncludeAmpBysideContent() {121  return <AmpIncludeCustomElement name="amp-byside-content" version="0.1" />122}123export function AmpIncludeAmpCallTracking() {124  return <AmpIncludeCustomElement name="amp-call-tracking" version="0.1" />125}126export function AmpIncludeAmpCarousel() {127  return <AmpIncludeCustomElement name="amp-carousel" version="0.2" />128}129export function AmpIncludeAmpConnatixPlayer() {130  return <AmpIncludeCustomElement name="amp-connatix-player" version="0.1" />131}132export function AmpIncludeAmpConsent() {133  return <AmpIncludeCustomElement name="amp-consent" version="0.1" />134}135export function AmpIncludeAmpDailymotion() {136  return <AmpIncludeCustomElement name="amp-dailymotion" version="0.1" />137}138export function AmpIncludeAmpDateCountdown() {139  return <AmpIncludeCustomElement name="amp-date-countdown" version="0.1" />140}141export function AmpIncludeAmpDateDisplay() {142  return <AmpIncludeCustomElement name="amp-date-display" version="0.1" />143}144export function AmpIncludeAmpDatePicker() {145  return <AmpIncludeCustomElement name="amp-date-picker" version="0.1" />146}147export function AmpIncludeAmpDelightPlayer() {148  return <AmpIncludeCustomElement name="amp-delight-player" version="0.1" />149}150export function AmpIncludeAmpDynamicCssClasses() {151  return (152    <AmpIncludeCustomElement name="amp-dynamic-css-classes" version="0.1" />153  )154}155export function AmpIncludeAmpEmbedlyCard() {156  return <AmpIncludeCustomElement name="amp-embedly-card" version="0.1" />157}158export function AmpIncludeAmpExperiment() {159  return <AmpIncludeCustomElement name="amp-experiment" version="1.0" />160}161export function AmpIncludeAmpFacebookComments() {162  return <AmpIncludeCustomElement name="amp-facebook-comments" version="0.1" />163}164export function AmpIncludeAmpFacebookLike() {165  return <AmpIncludeCustomElement name="amp-facebook-like" version="0.1" />166}167export function AmpIncludeAmpFacebookPage() {168  return <AmpIncludeCustomElement name="amp-facebook-page" version="0.1" />169}170export function AmpIncludeAmpFacebook() {171  return <AmpIncludeCustomElement name="amp-facebook" version="0.1" />172}173export function AmpIncludeAmpFitText() {174  return <AmpIncludeCustomElement name="amp-fit-text" version="0.1" />175}176export function AmpIncludeAmpFont() {177  return <AmpIncludeCustomElement name="amp-font" version="0.1" />178}179export function AmpIncludeAmpForm() {180  return <AmpIncludeCustomElement name="amp-form" version="0.1" />181}182export function AmpIncludeAmpFxCollection() {183  return <AmpIncludeCustomElement name="amp-fx-collection" version="0.1" />184}185export function AmpIncludeAmpFxFlyingCarpet() {186  return <AmpIncludeCustomElement name="amp-fx-flying-carpet" version="0.1" />187}188export function AmpIncludeAmpGeo() {189  return <AmpIncludeCustomElement name="amp-geo" version="0.1" />190}191export function AmpIncludeAmpGfycat() {192  return <AmpIncludeCustomElement name="amp-gfycat" version="0.1" />193}194export function AmpIncludeAmpGist() {195  return <AmpIncludeCustomElement name="amp-gist" version="0.1" />196}197export function AmpIncludeAmpGoogleDocumentEmbed() {198  return (199    <AmpIncludeCustomElement name="amp-google-document-embed" version="0.1" />200  )201}202export function AmpIncludeAmpHulu() {203  return <AmpIncludeCustomElement name="amp-hulu" version="0.1" />204}205export function AmpIncludeAmpIframe() {206  return <AmpIncludeCustomElement name="amp-iframe" version="0.1" />207}208export function AmpIncludeAmpImaVideo() {209  return <AmpIncludeCustomElement name="amp-ima-video" version="0.1" />210}211export function AmpIncludeAmpImageLightbox() {212  return <AmpIncludeCustomElement name="amp-image-lightbox" version="0.1" />213}214export function AmpIncludeAmpImageSlider() {215  return <AmpIncludeCustomElement name="amp-image-slider" version="0.1" />216}217export function AmpIncludeAmpImgur() {218  return <AmpIncludeCustomElement name="amp-imgur" version="0.1" />219}220export function AmpIncludeAmpInputmask() {221  return <AmpIncludeCustomElement name="amp-inputmask" version="0.1" />222}223export function AmpIncludeAmpInstagram() {224  return <AmpIncludeCustomElement name="amp-instagram" version="0.1" />225}226export function AmpIncludeAmpInstallServiceworker() {227  return (228    <AmpIncludeCustomElement name="amp-install-serviceworker" version="0.1" />229  )230}231export function AmpIncludeAmpIzlesene() {232  return <AmpIncludeCustomElement name="amp-izlesene" version="0.1" />233}234export function AmpIncludeAmpJwplayer() {235  return <AmpIncludeCustomElement name="amp-jwplayer" version="0.1" />236}237export function AmpIncludeAmpKalturaPlayer() {238  return <AmpIncludeCustomElement name="amp-kaltura-player" version="0.1" />239}240export function AmpIncludeAmpLightboxGallery() {241  return <AmpIncludeCustomElement name="amp-lightbox-gallery" version="0.1" />242}243export function AmpIncludeAmpLightbox() {244  return <AmpIncludeCustomElement name="amp-lightbox" version="0.1" />245}246export function AmpIncludeAmpLinkRewriter() {247  return <AmpIncludeCustomElement name="amp-link-rewriter" version="0.1" />248}249export function AmpIncludeAmpList() {250  return (251    <>252      <AmpIncludeAmpMustache />253      <AmpIncludeCustomElement name="amp-list" version="0.1" />254    </>255  )256}257export function AmpIncludeAmpLiveList() {258  return <AmpIncludeCustomElement name="amp-live-list" version="0.1" />259}260export function AmpIncludeAmpMathml() {261  return <AmpIncludeCustomElement name="amp-mathml" version="0.1" />262}263export function AmpIncludeAmpMegaphone() {264  return <AmpIncludeCustomElement name="amp-megaphone" version="0.1" />265}266export function AmpIncludeAmpMinuteMediaPlayer() {267  return (268    <AmpIncludeCustomElement name="amp-minute-media-player" version="0.1" />269  )270}271export function AmpIncludeAmpMowplayer() {272  return <AmpIncludeCustomElement name="amp-mowplayer" version="0.1" />273}274export function AmpIncludeAmpMustache() {275  return <AmpIncludeCustomTemplate name="amp-mustache" version="0.2" />276}277export function AmpIncludeAmpNextPage() {278  return <AmpIncludeCustomElement name="amp-next-page" version="0.1" />279}280export function AmpIncludeAmpNexxtvPlayer() {281  return <AmpIncludeCustomElement name="amp-nexxtv-player" version="0.1" />282}283export function AmpIncludeAmpO2Player() {284  return <AmpIncludeCustomElement name="amp-o2-player" version="0.1" />285}286export function AmpIncludeAmpOoyalaPlayer() {287  return <AmpIncludeCustomElement name="amp-ooyala-player" version="0.1" />288}289export function AmpIncludeAmpOrientationObserver() {290  return (291    <AmpIncludeCustomElement name="amp-orientation-observer" version="0.1" />292  )293}294export function AmpIncludeAmpPanZoom() {295  return <AmpIncludeCustomElement name="amp-pan-zoom" version="0.1" />296}297export function AmpIncludeAmpPinterest() {298  return <AmpIncludeCustomElement name="amp-pinterest" version="0.1" />299}300export function AmpIncludeAmpPlaybuzz() {301  return <AmpIncludeCustomElement name="amp-playbuzz" version="0.1" />302}303export function AmpIncludeAmpPositionObserver() {304  return <AmpIncludeCustomElement name="amp-position-observer" version="0.1" />305}306export function AmpIncludeAmpPowrPlayer() {307  return <AmpIncludeCustomElement name="amp-powr-player" version="0.1" />308}309export function AmpIncludeAmpReachPlayer() {310  return <AmpIncludeCustomElement name="amp-reach-player" version="0.1" />311}312export function AmpIncludeAmpRecaptchaInput() {313  return <AmpIncludeCustomElement name="amp-recaptcha-input" version="0.1" />314}315export function AmpIncludeAmpReddit() {316  return <AmpIncludeCustomElement name="amp-reddit" version="0.1" />317}318export function AmpIncludeAmpRiddleQuiz() {319  return <AmpIncludeCustomElement name="amp-riddle-quiz" version="0.1" />320}321export function AmpIncludeAmpScript() {322  return <AmpIncludeCustomElement name="amp-script" version="0.1" />323}324export function AmpIncludeAmpSelector() {325  return <AmpIncludeCustomElement name="amp-selector" version="0.1" />326}327export function AmpIncludeAmpSidebar() {328  return <AmpIncludeCustomElement name="amp-sidebar" version="0.1" />329}330export function AmpIncludeAmpSkimlinks() {331  return <AmpIncludeCustomElement name="amp-skimlinks" version="0.1" />332}333export function AmpIncludeAmpSlides() {334  return <AmpIncludeCustomElement name="amp-slides" version="0.1" />335}336export function AmpIncludeAmpSmartlinks() {337  return <AmpIncludeCustomElement name="amp-smartlinks" version="0.1" />338}339export function AmpIncludeAmpSocialShare() {340  return <AmpIncludeCustomElement name="amp-social-share" version="0.1" />341}342export function AmpIncludeAmpSoundcloud() {343  return <AmpIncludeCustomElement name="amp-soundcloud" version="0.1" />344}345export function AmpIncludeAmpSpringboardPlayer() {346  return <AmpIncludeCustomElement name="amp-springboard-player" version="0.1" />347}348export function AmpIncludeAmpStickyAd() {349  return <AmpIncludeCustomElement name="amp-sticky-ad" version="1.0" />350}351export function AmpIncludeAmpStoryAutoAds() {352  return <AmpIncludeCustomElement name="amp-story-auto-ads" version="0.1" />353}354export function AmpIncludeAmpStory() {355  return <AmpIncludeCustomElement name="amp-story" version="1.0" />356}357export function AmpIncludeAmpSubscriptions() {358  return <AmpIncludeCustomElement name="amp-subscriptions" version="0.1" />359}360export function AmpIncludeAmpSubscriptionsGoogle() {361  return (362    <AmpIncludeCustomElement name="amp-subscriptions-google" version="0.1" />363  )364}365export function AmpIncludeAmpTimeago() {366  return <AmpIncludeCustomElement name="amp-timeago" version="0.1" />367}368export function AmpIncludeAmpTruncateText() {369  return <AmpIncludeCustomElement name="amp-truncate-text" version="0.1" />370}371export function AmpIncludeAmpTwitter() {372  return <AmpIncludeCustomElement name="amp-twitter" version="0.1" />373}374export function AmpIncludeAmpUserLocation() {375  return <AmpIncludeCustomElement name="amp-user-location" version="0.1" />376}377export function AmpIncludeAmpUserNotification() {378  return <AmpIncludeCustomElement name="amp-user-notification" version="0.1" />379}380export function AmpIncludeAmpVideoDocking() {381  return <AmpIncludeCustomElement name="amp-video-docking" version="0.1" />382}383export function AmpIncludeAmpVideoIframe() {384  return <AmpIncludeCustomElement name="amp-video-iframe" version="0.1" />385}386export function AmpIncludeAmpVideo() {387  return <AmpIncludeCustomElement name="amp-video" version="0.1" />388}389export function AmpIncludeAmpVimeo() {390  return <AmpIncludeCustomElement name="amp-vimeo" version="0.1" />391}392export function AmpIncludeAmpVine() {393  return <AmpIncludeCustomElement name="amp-vine" version="0.1" />394}395export function AmpIncludeAmpViqeoPlayer() {396  return <AmpIncludeCustomElement name="amp-viqeo-player" version="0.1" />397}398export function AmpIncludeAmpVk() {399  return <AmpIncludeCustomElement name="amp-vk" version="0.1" />400}401export function AmpIncludeAmpWebPush() {402  return <AmpIncludeCustomElement name="amp-web-push" version="0.1" />403}404export function AmpIncludeAmpWistiaPlayer() {405  return <AmpIncludeCustomElement name="amp-wistia-player" version="0.1" />406}407export function AmpIncludeAmpYotpo() {408  return <AmpIncludeCustomElement name="amp-yotpo" version="0.1" />409}410export function AmpIncludeAmpYoutube() {411  return <AmpIncludeCustomElement name="amp-youtube" version="0.1" />...test_include.py
Source:test_include.py  
1from django.template import (2    Context, Template, TemplateDoesNotExist, TemplateSyntaxError, engines,3)4from django.test import SimpleTestCase, override_settings5from ..utils import setup6from .test_basic import basic_templates7include_fail_templates = {8    'include-fail1': '{% load bad_tag %}{% badtag %}',9    'include-fail2': '{% load broken_tag %}',10}11class IncludeTagTests(SimpleTestCase):12    @setup({'include01': '{% include "basic-syntax01" %}'}, basic_templates)13    def test_include01(self):14        output = self.engine.render_to_string('include01')15        self.assertEqual(output, 'something cool')16    @setup({'include02': '{% include "basic-syntax02" %}'}, basic_templates)17    def test_include02(self):18        output = self.engine.render_to_string('include02', {'headline': 'Included'})19        self.assertEqual(output, 'Included')20    @setup({'include03': '{% include template_name %}'}, basic_templates)21    def test_include03(self):22        output = self.engine.render_to_string(23            'include03',24            {'template_name': 'basic-syntax02', 'headline': 'Included'},25        )26        self.assertEqual(output, 'Included')27    @setup({'include04': 'a{% include "nonexistent" %}b'})28    def test_include04(self):29        template = self.engine.get_template('include04')30        if self.engine.debug:31            with self.assertRaises(TemplateDoesNotExist):32                template.render(Context({}))33        else:34            output = template.render(Context({}))35            self.assertEqual(output, "ab")36    @setup({37        'include 05': 'template with a space',38        'include06': '{% include "include 05"%}',39    })40    def test_include06(self):41        output = self.engine.render_to_string('include06')42        self.assertEqual(output, "template with a space")43    @setup({'include07': '{% include "basic-syntax02" with headline="Inline" %}'}, basic_templates)44    def test_include07(self):45        output = self.engine.render_to_string('include07', {'headline': 'Included'})46        self.assertEqual(output, 'Inline')47    @setup({'include08': '{% include headline with headline="Dynamic" %}'}, basic_templates)48    def test_include08(self):49        output = self.engine.render_to_string('include08', {'headline': 'basic-syntax02'})50        self.assertEqual(output, 'Dynamic')51    @setup(52        {'include09': '{{ first }}--'53                      '{% include "basic-syntax03" with first=second|lower|upper second=first|upper %}'54                      '--{{ second }}'},55        basic_templates,56    )57    def test_include09(self):58        output = self.engine.render_to_string('include09', {'first': 'Ul', 'second': 'lU'})59        self.assertEqual(output, 'Ul--LU --- UL--lU')60    @setup({'include10': '{% include "basic-syntax03" only %}'}, basic_templates)61    def test_include10(self):62        output = self.engine.render_to_string('include10', {'first': '1'})63        if self.engine.string_if_invalid:64            self.assertEqual(output, 'INVALID --- INVALID')65        else:66            self.assertEqual(output, ' --- ')67    @setup({'include11': '{% include "basic-syntax03" only with second=2 %}'}, basic_templates)68    def test_include11(self):69        output = self.engine.render_to_string('include11', {'first': '1'})70        if self.engine.string_if_invalid:71            self.assertEqual(output, 'INVALID --- 2')72        else:73            self.assertEqual(output, ' --- 2')74    @setup({'include12': '{% include "basic-syntax03" with first=1 only %}'}, basic_templates)75    def test_include12(self):76        output = self.engine.render_to_string('include12', {'second': '2'})77        if self.engine.string_if_invalid:78            self.assertEqual(output, '1 --- INVALID')79        else:80            self.assertEqual(output, '1 --- ')81    @setup(82        {'include13': '{% autoescape off %}{% include "basic-syntax03" %}{% endautoescape %}'},83        basic_templates,84    )85    def test_include13(self):86        output = self.engine.render_to_string('include13', {'first': '&'})87        if self.engine.string_if_invalid:88            self.assertEqual(output, '& --- INVALID')89        else:90            self.assertEqual(output, '& --- ')91    @setup(92        {'include14': '{% autoescape off %}'93                      '{% include "basic-syntax03" with first=var1 only %}'94                      '{% endautoescape %}'},95        basic_templates,96    )97    def test_include14(self):98        output = self.engine.render_to_string('include14', {'var1': '&'})99        if self.engine.string_if_invalid:100            self.assertEqual(output, '& --- INVALID')101        else:102            self.assertEqual(output, '& --- ')103    # Include syntax errors104    @setup({'include-error01': '{% include "basic-syntax01" with %}'})105    def test_include_error01(self):106        with self.assertRaises(TemplateSyntaxError):107            self.engine.get_template('include-error01')108    @setup({'include-error02': '{% include "basic-syntax01" with "no key" %}'})109    def test_include_error02(self):110        with self.assertRaises(TemplateSyntaxError):111            self.engine.get_template('include-error02')112    @setup({'include-error03': '{% include "basic-syntax01" with dotted.arg="error" %}'})113    def test_include_error03(self):114        with self.assertRaises(TemplateSyntaxError):115            self.engine.get_template('include-error03')116    @setup({'include-error04': '{% include "basic-syntax01" something_random %}'})117    def test_include_error04(self):118        with self.assertRaises(TemplateSyntaxError):119            self.engine.get_template('include-error04')120    @setup({'include-error05': '{% include "basic-syntax01" foo="duplicate" foo="key" %}'})121    def test_include_error05(self):122        with self.assertRaises(TemplateSyntaxError):123            self.engine.get_template('include-error05')124    @setup({'include-error06': '{% include "basic-syntax01" only only %}'})125    def test_include_error06(self):126        with self.assertRaises(TemplateSyntaxError):127            self.engine.get_template('include-error06')128    @setup(include_fail_templates)129    def test_include_fail1(self):130        with self.assertRaises(RuntimeError):131            self.engine.get_template('include-fail1')132    @setup(include_fail_templates)133    def test_include_fail2(self):134        with self.assertRaises(TemplateSyntaxError):135            self.engine.get_template('include-fail2')136    @setup({'include-error07': '{% include "include-fail1" %}'}, include_fail_templates)137    def test_include_error07(self):138        template = self.engine.get_template('include-error07')139        if self.engine.debug:140            with self.assertRaises(RuntimeError):141                template.render(Context())142        else:143            self.assertEqual(template.render(Context()), '')144    @setup({'include-error08': '{% include "include-fail2" %}'}, include_fail_templates)145    def test_include_error08(self):146        template = self.engine.get_template('include-error08')147        if self.engine.debug:148            with self.assertRaises(TemplateSyntaxError):149                template.render(Context())150        else:151            self.assertEqual(template.render(Context()), '')152    @setup({'include-error09': '{% include failed_include %}'}, include_fail_templates)153    def test_include_error09(self):154        context = Context({'failed_include': 'include-fail1'})155        template = self.engine.get_template('include-error09')156        if self.engine.debug:157            with self.assertRaises(RuntimeError):158                template.render(context)159        else:160            self.assertEqual(template.render(context), '')161    @setup({'include-error10': '{% include failed_include %}'}, include_fail_templates)162    def test_include_error10(self):163        context = Context({'failed_include': 'include-fail2'})164        template = self.engine.get_template('include-error10')165        if self.engine.debug:166            with self.assertRaises(TemplateSyntaxError):167                template.render(context)168        else:169            self.assertEqual(template.render(context), '')170class IncludeTests(SimpleTestCase):171    # Test the base loader class via the app loader. load_template172    # from base is used by all shipped loaders excepting cached,173    # which has its own test.174    @override_settings(TEMPLATES=[{175        'BACKEND': 'django.template.backends.django.DjangoTemplates',176        'APP_DIRS': True,177        'OPTIONS': {178            # Enable debug, otherwise the exception raised during179            # {% include %} processing will be suppressed.180            'debug': True,181        }182    }])183    def test_include_missing_template(self):184        """185        Tests that the correct template is identified as not existing186        when {% include %} specifies a template that does not exist.187        """188        template = engines['django'].get_template('test_include_error.html')189        with self.assertRaises(TemplateDoesNotExist) as e:190            template.render()191        self.assertEqual(e.exception.args[0], 'missing.html')192    # Test the base loader class via the app loader. load_template193    # from base is used by all shipped loaders excepting cached,194    # which has its own test.195    @override_settings(TEMPLATES=[{196        'BACKEND': 'django.template.backends.django.DjangoTemplates',197        'APP_DIRS': True,198        'OPTIONS': {199            # Enable debug, otherwise the exception raised during200            # {% include %} processing will be suppressed.201            'debug': True,202        }203    }])204    def test_extends_include_missing_baseloader(self):205        """206        #12787 -- Tests that the correct template is identified as not existing207        when {% extends %} specifies a template that does exist, but that208        template has an {% include %} of something that does not exist.209        """210        template = engines['django'].get_template('test_extends_error.html')211        with self.assertRaises(TemplateDoesNotExist) as e:212            template.render()213        self.assertEqual(e.exception.args[0], 'missing.html')214    @override_settings(TEMPLATES=[{215        'BACKEND': 'django.template.backends.django.DjangoTemplates',216        'OPTIONS': {217            'debug': True,218            'loaders': [219                ('django.template.loaders.cached.Loader', [220                    'django.template.loaders.app_directories.Loader',221                ]),222            ],223        },224    }])225    def test_extends_include_missing_cachedloader(self):226        """227        Test the cache loader separately since it overrides load_template.228        """229        template = engines['django'].get_template('test_extends_error.html')230        with self.assertRaises(TemplateDoesNotExist) as e:231            template.render()232        self.assertEqual(e.exception.args[0], 'missing.html')233        # Repeat to ensure it still works when loading from the cache234        template = engines['django'].get_template('test_extends_error.html')235        with self.assertRaises(TemplateDoesNotExist) as e:236            template.render()237        self.assertEqual(e.exception.args[0], 'missing.html')238    def test_include_template_argument(self):239        """240        Support any render() supporting object241        """242        ctx = Context({243            'tmpl': Template('This worked!'),244        })245        outer_tmpl = Template('{% include tmpl %}')246        output = outer_tmpl.render(ctx)247        self.assertEqual(output, 'This worked!')248    @override_settings(TEMPLATES=[{249        'BACKEND': 'django.template.backends.django.DjangoTemplates',250        'OPTIONS': {251            'debug': True,252        },253    }])254    def test_include_immediate_missing(self):255        """256        #16417 -- Include tags pointing to missing templates should not raise257        an error at parsing time.258        """259        template = Template('{% include "this_does_not_exist.html" %}')260        self.assertIsInstance(template, Template)261    @override_settings(TEMPLATES=[{262        'BACKEND': 'django.template.backends.django.DjangoTemplates',263        'APP_DIRS': True,264        'OPTIONS': {265            'debug': True,266        },267    }])268    def test_include_recursive(self):269        comments = [270            {271                'comment': 'A1',272                'children': [273                    {'comment': 'B1', 'children': []},274                    {'comment': 'B2', 'children': []},275                    {'comment': 'B3', 'children': [276                        {'comment': 'C1', 'children': []}277                    ]},278                ]279            }280        ]281        t = engines['django'].get_template('recursive_include.html')282        self.assertEqual(283            "Recursion!  A1  Recursion!  B1   B2   B3  Recursion!  C1",284            t.render({'comments': comments}).replace(' ', '').replace('\n', ' ').strip(),...formatter_test.py
Source:formatter_test.py  
1import unittest2from drake.tools.lint.formatter import FormatterBase, IncludeFormatter3class TestFormatterBase(unittest.TestCase):4    def test_essentials(self):5        original_lines = [6            '// Line 1\n',7            '/* Line 2 */\n',8            '\n',9        ]10        dut = FormatterBase('filename.cc', readlines=original_lines)11        # Everything starts out unchanged.12        self.assertTrue(dut.is_same_as_original())13        self.assertTrue(dut.is_permutation_of_original())14        self.assertEqual(dut.get_all_lines(), original_lines)15        self.assertTrue(dut.get_first_differing_original_index() is None)16        # Basic getters.17        self.assertEqual(dut.get_num_lines(), 3)18        self.assertTrue(dut.is_blank_line(2))19        self.assertEqual(dut.get_line(0), '// Line 1\n')20        # Reverse it and end up with a permutation.21        dut.set_all_lines(reversed(dut.get_all_lines()))22        self.assertFalse(dut.is_same_as_original())23        self.assertTrue(dut.is_permutation_of_original())24        self.assertEqual(dut.get_first_differing_original_index(), 0)25        # Rebuild it using insertion and removal.26        dut.set_all_lines(['\n'] * 3)27        dut.set_line(0, '/* Line 2 */\n')28        dut.insert_lines(0, ['AAA\n', '// Line 1\n'])29        dut.remove_all([0, 3])30        self.assertEqual(dut.get_all_lines(), original_lines)31    def test_format_ranges(self):32        original_lines = [33            '#include "line0"\n',34            '// clang-format off\n',35            '#include "line2"\n',36            '// clang-format on\n',37            '#include "line4"\n',38            '#include "line5"\n',39            '/* clang-format off */\n',40            '#include "line7"\n',41            '#include "line8"\n',42            '/* clang-format on */\n',43            '#include "line10"\n',44        ]45        dut = FormatterBase("filename.cc", readlines=original_lines)46        self.assertEqual(47            dut.get_format_ranges(), [[0], [4, 5], [10]])48        self.assertEqual(49            dut.get_non_format_ranges(), [[1, 2, 3], [6, 7, 8, 9]])50    def test_dos(self):51        original_lines = [52            '#include "line0"\r\n',53        ]54        with self.assertRaisesRegexp(Exception, "DOS newline"):55            FormatterBase("filename.cc", readlines=original_lines)56class TestIncludeFormatter(unittest.TestCase):57    def _split(self, triple_quoted_file_contents):58        lines = triple_quoted_file_contents.split("\n")59        assert len(lines) >= 260        assert lines[0] == ""  # Detritus from first triple quote.61        assert lines[-1] == ""  # Detritus from last triple quote.62        del lines[0]63        del lines[-1]64        return [line + "\n" for line in lines]65    def _check(self, basename, original, expected, first_differing):66        original_lines = self._split(original)67        expected_lines = self._split(expected)68        dut = IncludeFormatter(69            "drake/dummy/" + basename,70            readlines=original_lines)71        dut.format_includes()72        self.assertEqual(dut.get_all_lines(), expected_lines)73        self.assertEqual(dut.get_first_differing_original_index(),74                         first_differing)75    def test_basic(self):76        # A pile of headers gets sorted per cppguide:77        # - The related header78        # - C system files79        # - C++ system files80        # - Other libraries' .h files81        # - Your project's .h files82        original = """83#include "drake/common/drake_assert.h"84#include "drake/dummy/bar.h"85#include "drake/dummy/dut.h"86#include <gtest/gtest.h>87#include <Eigen/Dense>88#include <algorithm>89#include <poll.h>90#include <sys/wait.h>91#include <vector>92"""93        expected = """94#include "drake/dummy/dut.h"95#include <poll.h>96#include <sys/wait.h>97#include <algorithm>98#include <vector>99#include <Eigen/Dense>100#include <gtest/gtest.h>101#include "drake/common/drake_assert.h"102#include "drake/dummy/bar.h"103"""104        self._check("dut.cc", original, expected, 0)105    def test_nothing(self):106        # A file with _no_ include statements.107        original = """108namespace { }109"""110        self._check("dut.cc", original, original, None)111    def test_regroup(self):112        # Wrongly grouped whitespace.113        original = """114#include "drake/dummy/dut.h"115#include <Eigen/Dense>116#include <algorithm>117#include <vector>118#include "drake/common/drake_assert.h"119#include "drake/dummy/bar.h"120#include <gtest/gtest.h>121"""122        expected = """123#include "drake/dummy/dut.h"124#include <algorithm>125#include <vector>126#include <Eigen/Dense>127#include <gtest/gtest.h>128#include "drake/common/drake_assert.h"129#include "drake/dummy/bar.h"130"""131        self._check("dut.cc", original, expected, 2)132    def test_format_off(self):133        # "clang-format off".134        original = """135#include "drake/dummy/dut.h"136// clang-format off137#ifdef FOO138#include <algorithm>139#include <vector>140#else141#include <vector>142#include <algorithm>143#endif144// clang-format on145#include "drake/common/drake_assert.h"146"""147        self._check("dut.cc", original, original, None)148    def test_cc_uses_single_inl(self):149        # Only a single "-inl.h" include.150        original = """151#include "drake/dummy/dut-inl.h"152namespace { }153"""154        self._check("dut.cc", original, original, None)155    def test_cc_uses_inl_and_more(self):156        # Presence of "-inl.h" pattern and other things.157        original = """158#include "drake/dummy/dut-inl.h"159#include "drake/common/drake_assert.h"160#include "drake/common/drake_deprecated.h"161namespace { }162"""163        self._check("xxx.cc", original, original, None)164    def test_target_is_header(self):165        # A header file.166        original = """167#include "drake/common/drake_assert.h"168#include <algorithm>169namespace { }170"""171        expected = """172#include <algorithm>173#include "drake/common/drake_assert.h"174namespace { }175"""176        self._check("dut.h", original, expected, 0)177    def test_target_is_inl(self):178        # An *-inl.h file.179        original = """180#include "drake/dummy/dut.h"181#include <vector>182namespace { }183"""184        self._check("dut-inl.h", original, original, None)185    def test_associated_comment(self):186        # A comment prior to a line.187        original = """188#include "drake/dummy/dut.h"189// Some comment describing the next line.190#include <vector>191namespace { }192"""193        self._check("dut.cc", original, original, None)194    def test_file_opening_comment(self):195        # A comment atop the file with no blank line.196        original = """197/// @file dut.cc198/// Mumble mumble199///200#include <string>201#include <vector>202"""203        self._check("dut.cc", original, original, None)204    def test_internal_related_header(self):205        # Two related headers, guarded by "clang-format off".206        original = """207/* clang-format off (with explanatory comment) */208#include "drake/dummy/dut.h"209#include "drake/dummy/dut_internal.h"210/* clang-format on  (with explanatory comment) */211#include <vector>212#include <string>213#include "drake/dummy/drake_assert.h"214#include "drake/dummy/drake_deprecated.h"215"""216        expected = """217/* clang-format off (with explanatory comment) */218#include "drake/dummy/dut.h"219#include "drake/dummy/dut_internal.h"220/* clang-format on  (with explanatory comment) */221#include <string>222#include <vector>223#include "drake/dummy/drake_assert.h"224#include "drake/dummy/drake_deprecated.h"225"""226        self._check("dut.cc", original, expected, 5)227    def test_resort_solo_groups(self):228        # Groups of one, but sorted incorrectly.229        original = """230#include "drake/dummy/dut.h"231#include "drake/common/drake_assert.h"232#include <vector>233"""234        expected = """235#include "drake/dummy/dut.h"236#include <vector>237#include "drake/common/drake_assert.h"238"""239        self._check("dut.cc", original, expected, 2)240    def test_nontrivial_reformatting(self):241        # If clang-format changes any lines, we want to fail-fast.242        # (Note the two spaces between #include and the double quote.)243        original_lines = ['#include  "nontrivial.h"\n']244        dut = IncludeFormatter("nontrivial.cc", readlines=original_lines)245        dut.format_includes()246        with self.assertRaisesRegexp(Exception, 'not just a shuffle'):...options_bundle.js
Source:options_bundle.js  
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//5// This file exists to aggregate all of the javascript used by the6// settings page into a single file which will be flattened and served7// as a single resource.8<include src="preferences.js"></include>9<include src="controlled_setting.js"></include>10<include src="deletable_item_list.js"></include>11<include src="editable_text_field.js"></include>12<include src="hotword_search_setting_indicator.js"></include>13<include src="inline_editable_list.js"></include>14<include src="options_page.js"></include>15<include src="pref_ui.js"></include>16<include src="settings_dialog.js"></include>17<include src="settings_banner.js"></include>18<if expr="chromeos">19<include src="../chromeos/user_images_grid.js"></include>20// DO NOT BREAK THE FOLLOWING INCLUDE LINE INTO SEPARATE LINES!21// Even though the include line spans more than 80 characters,22// The grit html inlining parser will leave the end tag behind,23// causing a runtime JS break.24<include src="../../../../ui/webui/resources/js/chromeos/ui_account_tweaks.js"></include>25<include src="chromeos/change_picture_options.js"></include>26<include src="chromeos/internet_detail_ip_address_field.js"></include>27<include src="chromeos/internet_detail.js"></include>28<include src="chromeos/network_list.js"></include>29<include src="chromeos/preferred_networks.js"></include>30<include src="chromeos/bluetooth_device_list.js"></include>31<include src="chromeos/bluetooth_add_device_overlay.js"></include>32<include src="chromeos/bluetooth_pair_device_overlay.js"></include>33<include src="chromeos/accounts_options.js"></include>34<include src="chromeos/proxy_rules_list.js"></include>35<include src="chromeos/accounts_user_list.js"></include>36<include src="chromeos/accounts_user_name_edit.js"></include>37<include src="chromeos/display_options.js"></include>38<include src="chromeos/display_overscan.js"></include>39<include src="chromeos/keyboard_overlay.js"></include>40<include src="chromeos/pointer_overlay.js"></include>41<include src="chromeos/third_party_ime_confirm_overlay.js"></include>42var AccountsOptions = options.AccountsOptions;43var ChangePictureOptions = options.ChangePictureOptions;44var DetailsInternetPage = options.internet.DetailsInternetPage;45var DisplayOptions = options.DisplayOptions;46var DisplayOverscan = options.DisplayOverscan;47var BluetoothOptions = options.BluetoothOptions;48var BluetoothPairing = options.BluetoothPairing;49var KeyboardOverlay = options.KeyboardOverlay;50var PointerOverlay = options.PointerOverlay;51var UIAccountTweaks = uiAccountTweaks.UIAccountTweaks;52</if>53<if expr="use_nss">54<include src="certificate_tree.js"></include>55<include src="certificate_manager.js"></include>56<include src="certificate_restore_overlay.js"></include>57<include src="certificate_backup_overlay.js"></include>58<include src="certificate_edit_ca_trust_overlay.js"></include>59<include src="certificate_import_error_overlay.js"></include>60var CertificateManager = options.CertificateManager;61var CertificateRestoreOverlay = options.CertificateRestoreOverlay;62var CertificateBackupOverlay = options.CertificateBackupOverlay;63var CertificateEditCaTrustOverlay = options.CertificateEditCaTrustOverlay;64var CertificateImportErrorOverlay = options.CertificateImportErrorOverlay;65</if>66<include src="alert_overlay.js"></include>67<include src="autofill_edit_address_overlay.js"></include>68<include src="autofill_edit_creditcard_overlay.js"></include>69<include src="autofill_options_list.js"></include>70<include src="autofill_options.js"></include>71<include src="automatic_settings_reset_banner.js"></include>72<include src="browser_options.js"></include>73<include src="browser_options_profile_list.js"></include>74<include src="browser_options_startup_page_list.js"></include>75<include src="clear_browser_data_overlay.js"></include>76<include src="confirm_dialog.js"></include>77<include src="content_settings.js"></include>78<include src="content_settings_exceptions_area.js"></include>79<include src="content_settings_ui.js"></include>80<include src="cookies_list.js"></include>81<include src="cookies_view.js"></include>82<include src="factory_reset_overlay.js"></include>83<include src="font_settings.js"></include>84<if expr="enable_google_now">85<include src="geolocation_options.js"></include>86</if>87<include src="handler_options.js"></include>88<include src="handler_options_list.js"></include>89<include src="home_page_overlay.js"></include>90<include src="import_data_overlay.js"></include>91<include src="language_add_language_overlay.js"></include>92<if expr="not is_macosx">93<include src="language_dictionary_overlay_word_list.js"></include>94<include src="language_dictionary_overlay.js"></include>95</if>96<include src="language_list.js"></include>97<include src="language_options.js"></include>98<include src="manage_profile_overlay.js"></include>99<include src="managed_user_create_confirm.js"</include>100<include src="managed_user_import.js"></include>101<include src="managed_user_learn_more.js"</include>102<include src="managed_user_list.js"></include>103<include src="managed_user_list_data.js"></include>104<include src="options_focus_manager.js"></include>105<include src="password_manager.js"></include>106<include src="password_manager_list.js"></include>107<include src="profiles_icon_grid.js"></include>108<include src="reset_profile_settings_banner.js"></include>109<include src="reset_profile_settings_overlay.js"></include>110<include src="search_engine_manager.js"></include>111<include src="search_engine_manager_engine_list.js"></include>112<include src="search_page.js"></include>113<include src="startup_overlay.js"></include>114<include src="../sync_setup_overlay.js"></include>115<include src="../uber/uber_utils.js"></include>116<include src="options.js"></include>117<if expr="enable_settings_app">118<include src="options_settings_app.js"></include>...tiny_mce_dev.js
Source:tiny_mce_dev.js  
...33		it = li[i].split('=');34		query[unescape(it[0])] = unescape(it[1]);35	}36	nl = null; // IE leak fix37	function include(u) {38		scripts.push(base + '/classes/' + u);39	};40	function load() {41		var i, html = '';42		for (i = 0; i < scripts.length; i++)43			html += '<script type="text/javascript" src="' + scripts[i] + '"></script>\n';44		document.write(html);45	};46	// Firebug47	if (query.debug && !("console" in window)) {48		include('firebug/firebug-lite.js');49	}50	// Core ns51	include('tinymce.js');52	// Load framework adapter53	if (query.api)54		include('adapter/' + query.api + '/adapter.js');55	// tinymce.util.*56	include('util/Dispatcher.js');57	include('util/URI.js');58	include('util/Cookie.js');59	include('util/JSON.js');60	include('util/JSONP.js');61	include('util/XHR.js');62	include('util/JSONRequest.js');63	include('util/VK.js');64	include('util/Quirks.js');65	// tinymce.html.*66	include('html/Entities.js');67	include('html/Styles.js');68	include('html/Schema.js');69	include('html/SaxParser.js');70	include('html/Node.js');71	include('html/DomParser.js');72	include('html/Serializer.js');73	include('html/Writer.js');74	// tinymce.dom.*75	include('dom/DOMUtils.js');76	include('dom/Range.js');77	include('dom/TridentSelection.js');78	include('dom/Sizzle.js');79	include('dom/EventUtils.js');80	include('dom/Element.js');81	include('dom/Selection.js');82	include('dom/Serializer.js');83	include('dom/ScriptLoader.js');84	include('dom/TreeWalker.js');85	include('dom/RangeUtils.js');86	// tinymce.ui.*87	include('ui/KeyboardNavigation.js');88	include('ui/Control.js');89	include('ui/Container.js');90	include('ui/Separator.js');91	include('ui/MenuItem.js');92	include('ui/Menu.js');93	include('ui/DropMenu.js');94	include('ui/Button.js');95	include('ui/ListBox.js');96	include('ui/NativeListBox.js');97	include('ui/MenuButton.js');98	include('ui/SplitButton.js');99	include('ui/ColorSplitButton.js');100	include('ui/ToolbarGroup.js');101	include('ui/Toolbar.js');102	// tinymce.*103	include('AddOnManager.js');104	include('EditorManager.js');105	include('Editor.js');106	include('EditorCommands.js');107	include('UndoManager.js');108	include('ForceBlocks.js');109	include('ControlManager.js');110	include('WindowManager.js');111	include('Formatter.js');112	include('LegacyInput.js');113	load();...meshphong_frag.glsl.js
Source:meshphong_frag.glsl.js  
1export default /* glsl */`2#define PHONG3uniform vec3 diffuse;4uniform vec3 emissive;5uniform vec3 specular;6uniform float shininess;7uniform float opacity;8#include <common>9#include <packing>10#include <dithering_pars_fragment>11#include <color_pars_fragment>12#include <uv_pars_fragment>13#include <uv2_pars_fragment>14#include <map_pars_fragment>15#include <alphamap_pars_fragment>16#include <aomap_pars_fragment>17#include <lightmap_pars_fragment>18#include <emissivemap_pars_fragment>19#include <envmap_common_pars_fragment>20#include <envmap_pars_fragment>21#include <cube_uv_reflection_fragment>22#include <fog_pars_fragment>23#include <bsdfs>24#include <lights_pars_begin>25#include <lights_phong_pars_fragment>26#include <shadowmap_pars_fragment>27#include <bumpmap_pars_fragment>28#include <normalmap_pars_fragment>29#include <specularmap_pars_fragment>30#include <logdepthbuf_pars_fragment>31#include <clipping_planes_pars_fragment>32void main() {33	#include <clipping_planes_fragment>34	vec4 diffuseColor = vec4( diffuse, opacity );35	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );36	vec3 totalEmissiveRadiance = emissive;37	#include <logdepthbuf_fragment>38	#include <map_fragment>39	#include <color_fragment>40	#include <alphamap_fragment>41	#include <alphatest_fragment>42	#include <specularmap_fragment>43	#include <normal_fragment_begin>44	#include <normal_fragment_maps>45	#include <emissivemap_fragment>46	// accumulation47	#include <lights_phong_fragment>48	#include <lights_fragment_begin>49	#include <lights_fragment_maps>50	#include <lights_fragment_end>51	// modulation52	#include <aomap_fragment>53	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;54	#include <envmap_fragment>55	gl_FragColor = vec4( outgoingLight, diffuseColor.a );56	#include <tonemapping_fragment>57	#include <encodings_fragment>58	#include <fog_fragment>59	#include <premultiplied_alpha_fragment>60	#include <dithering_fragment>61}...pkg.installspace.context.pc.py
Source:pkg.installspace.context.pc.py  
1# generated from catkin/cmake/template/pkg.context.pc.in2CATKIN_PACKAGE_PREFIX = ""3PROJECT_PKG_CONFIG_INCLUDE_DIRS = "/usr/include;/usr/include/gazebo-9;/usr/include/bullet;/usr/include/simbody;/usr/include/sdformat-6.2;/usr/include/ignition/math4;/usr/include/OGRE;/usr/include/OGRE/Terrain;/usr/include/OGRE/Paging;/usr/include/ignition/transport4;/usr/include/ignition/msgs1;/usr/include/ignition/common1;/usr/include/ignition/fuel_tools1".split(';') if "/usr/include;/usr/include/gazebo-9;/usr/include/bullet;/usr/include/simbody;/usr/include/sdformat-6.2;/usr/include/ignition/math4;/usr/include/OGRE;/usr/include/OGRE/Terrain;/usr/include/OGRE/Paging;/usr/include/ignition/transport4;/usr/include/ignition/msgs1;/usr/include/ignition/common1;/usr/include/ignition/fuel_tools1" != "" else []4PROJECT_CATKIN_DEPENDS = "roscpp".replace(';', ' ')5PKG_CONFIG_LIBRARIES_WITH_PREFIX = "-lActorCollisionsPlugin".split(';') if "-lActorCollisionsPlugin" != "" else []6PROJECT_NAME = "uol_cmp9767m_base"7PROJECT_SPACE_DIR = "/home/thememorydealer/catkin_ws/install"...Using AI Code Generation
1const chai = require('chai');2const expect = chai.expect;3const assert = chai.assert;4const should = chai.should();5const chaiHttp = require('chai-http');6chai.use(chaiHttp);7const mocha = require('mocha');8const describe = mocha.describe;9const it = mocha.it;10const app = require('../app');11const config = require('../config');12const request = require('request');13const supertest = require('supertest');14const mongoose = require('mongoose');15const User = require('../models/user');16const jwt = require('jsonwebtoken');17const bcrypt = require('bcrypt');18const saltRounds = 10;19const nodemailer = require('nodemailer');20const { body,validationResult } = require('express-validator/check');21const { sanitizeBody } = require('express-validator/filter');22const multer = require('multer');23const passport = require('passport');24const LocalStrategy = require('passport-local').Strategy;25const QRCode = require('qrcode');26const PDFDocument = require('pdfkit');27const fs = require('fs');28const jwt = require('jsonwebtoken');29const nodemailer = require('nodemailer');30const crypto = require('crypto');31const multer = require('multer');32const nodemailer = require('nodemailer');33const { body,validationResult } = require('express-validator/check');34const { sanitizeBody } = require('express-validator/filter');Using AI Code Generation
1const chai = require('chai');2const expect = chai.expect;3const should = chai.should();4const assert = chai.assert;5describe('Array', function() {6  describe('#indexOf()', function() {7    it('should return -1 when the value is not present', function() {8      assert.equal([1,2,3].indexOf(4), -1);9    });10  });11});12const chai = require('chai');13const expect = chai.expect;14const should = chai.should();15const assert = chai.assert;16describe('Array', function() {17  describe('#indexOf()', function() {18    it('should return -1 when the value is not present', function() {19      [1,2,3].indexOf(4).should.equal(-1);20    });21  });22});23const chai = require('chai');24const expect = chai.expect;25const should = chai.should();26const assert = chai.assert;27describe('Array', function() {28  describe('#indexOf()', function() {29    it('should return -1 when the value is not present', function() {30      expect([1,2,3].indexOf(4)).to.equal(-1);31    });32  });33});34const chai = require('chai');35const expect = chai.expect;36const should = chai.should();37const assert = chai.assert;38describe('Array', function() {39  describe('#indexOf()', function() {40    it('should return -1 when the value is not present', function() {41      assert.equal([1,2,3].indexOf(4), -1);42    });43  });44});45const chai = require('chai');46const expect = chai.expect;47const should = chai.should();Using AI Code Generation
1const chai = require('chai');2const expect = chai.expect;3const should = chai.should();4const assert = chai.assert;5const chaiHttp = require('chai-http');6const server = require('../app.js');7chai.use(chaiHttp);8describe('Test', function () {9    it('should return true', function () {10        expect(true).to.be.true;11    });12    it('should return false', function () {13        expect(false).to.not.be.true;14    });15    it('should return true', function () {16        assert.isTrue(true);17    });18    it('should return false', function () {19        assert.isFalse(false);20    });21    it('should return true', function () {22        true.should.be.true;23    });24    it('should return false', function () {25        false.should.not.be.true;26    });27    it('should return true', function () {28        true.should.be.true;29    });30    it('should return false', function () {31        false.should.not.be.true;32    });33    it('should return true', function () {34        true.should.be.true;35    });36    it('should return false', function () {37        false.should.not.be.true;38    });39    it('should return true', function () {40        true.should.be.true;41    });42    it('should return false', function () {43        false.should.not.be.true;44    });45    it('should return true', function () {46        true.should.be.true;47    });48    it('should return false', function () {49        false.should.not.be.true;50    });51    it('should return true', function () {52        true.should.be.true;53    });54    it('should return false', function () {55        false.should.not.be.true;56    });57    it('should return true', function () {58        true.should.be.true;59    });60    it('should return false', function () {61        false.should.not.be.true;62    });63    it('should return true', function () {64        true.should.be.true;65    });66    it('should return false', function () {67        false.should.not.be.true;68    });69    it('should return true', function () {70        true.should.be.true;71    });72    it('should return false', function () {73        false.should.not.be.true;74    });75    it('should return true', function () {76        true.should.be.true;77    });78    it('should return false', function () {Using AI Code Generation
1const chai = require("chai");2const expect = chai.expect;3const chai = require("chai");4const expect = chai.expect;5const chaiHttp = require("chai-http");6const server = require("../server");7chai.use(chaiHttp);8const chai = require("chai");9const expect = chai.expect;10const chaiHttp = require("chai-http");11const server = require("../server");12chai.use(chaiHttp);13const chai = require("chai");14const expect = chai.expect;15const chaiHttp = require("chai-http");16const server = require("../server");17chai.use(chaiHttp);18const chai = require("chai");19const expect = chai.expect;20const chaiHttp = require("chai-http");21const server = require("../server");22chai.use(chaiHttp);23const chai = require("chai");24const expect = chai.expect;25const chaiHttp = require("chai-http");26const server = require("../server");27chai.use(chaiHttp);28const chai = require("chai");29const expect = chai.expect;30const chaiHttp = require("chai-http");31const server = require("../server");32chai.use(chaiHttp);33const chai = require("chai");34const expect = chai.expect;35const chaiHttp = require("chai-http");36const server = require("../server");37chai.use(chaiHttp);38const chai = require("chai");39const expect = chai.expect;40const chaiHttp = require("chai-http");41const server = require("../server");42chai.use(chaiHttp);43const chai = require("chai");44const expect = chai.expect;45const chaiHttp = require("chai-http");46const server = require("../server");47chai.use(chaiHttp);48const chai = require("chai");49const expect = chai.expect;50const chaiHttp = require("chai-http");51const server = require("../server");52chai.use(chaiHttp);53const chai = require("chai");54const expect = chai.expect;55const chaiHttp = require("chai-http");56const server = require("../server");57chai.use(chaiHttp);Using AI Code Generation
1const chain = require('./chain.js');2var myChain = new chain();3myChain.addBlock(new chain.Block("First block in the chain - Genesis block"));4myChain.addBlock(new chain.Block("Second block in the chain"));5myChain.addBlock(new chain.Block("Third block in the chain"));6console.log(JSON.stringify(myChain, null, 4));7validate() {8  let errorLog = [];9  for (let i = 0; i < this.chain.length; i++) {10    const currentBlock = this.chain[i];11    const previousBlock = this.chain[i - 1];12    if (currentBlock.hash !== currentBlock.calculateHash()) {13      errorLog.push(i);14    }15    if (currentBlock.previousBlockHash !== previousBlock.hash) {16      errorLog.push(i);17    }18  }19  return errorLog.length > 0 ? false : true;20}21const chain = require('./chain.js');22var myChain = new chain();23myChain.addBlock(new chain.Block("First block in the chain - Genesis block"));24myChain.addBlock(new chain.Block("Second block in the chain"));25myChain.addBlock(new chain.Block("Third block in the chain"));26console.log("Is chain valid? " + myChain.validate());27modifyBlock(blockHeight, blockData) {28  if (blockHeight >= this.chain.length) {29    return false;30  }31  const block = this.chain[blockHeight];32  block.data = blockData;Using AI Code Generation
1const expect = require('chai').expect;2const add = require('../add.js');3describe('add', function() {4  it('should add two numbers', function() {5    expect(add(2, 3)).to.equal(5);6  });7});8function add(a, b) {9  return a + b;10}11module.exports = add;121 passing (9ms)13const expect = require('chai').expect;14const add = require('../add.js');15describe('add', function() {16  it('should add two numbers', function() {17    expect(add(2, 3)).to.equal(5);18    expect(add(2, 3)).to.not.equal(6);19    expect(add(2, 3)).to.be.a('number');20  });21});221 passing (9ms)23const expect = require('chai').expect;24const add = require('../add.js');25describe('add', function() {26  it('should add two numbers', function() {27    expect(add(2, 3)).to.equal(5);28    expect(add(2, 3)).to.not.equal(6);29    expect(add(2, 3)).to.be.a('number');30    expect(add(2, 3)).to.be.above(4);31    expect(add(2, 3)).to.be.below(6);32  });33});341 passing (9ms)35const expect = require('chai').expect;36const add = require('../add.js');37describe('add', function() {38  it('should add two numbers', function() {39    expect(add(2, 3)).to.equal(5Using AI Code Generation
1var chai = require('chai');2var expect = chai.expect;3var assert = chai.assert;4var should = chai.should();5var hello = require('../hello.js');6describe('Hello', function() {7    describe('#sayHello()', function() {8        it('should return hello', function() {9            expect(hello.sayHello()).to.equal('hello');10        });11        it('should return type string', function() {12            assert.typeOf(hello.sayHello(), 'string');13        });14        it('should not return number', function() {15            hello.sayHello().should.not.be.a('number');16        });17    });18});19var hello = function() {20    return 'hello';21};22module.exports.sayHello = hello;23at Function.Module._resolveFilename (module.js:338:15)24at Function.Module._load (module.js:280:25)25at Module.require (module.js:364:17)26at require (module.js:380:17)27at Object. (/home/rohit/Workspace/Chai/test/test.js:3:13)28at Module._compile (module.js:456:26)29at Object.Module._extensions..js (module.js:474:10)30at Module.load (module.js:356:32)31at Function.Module._load (module.js:312:12)32at Module.require (module.js:364:17)Using AI Code Generation
1module.exports = function(){2    return {3        add: function(num1, num2) {4            this.result = num1 + num2;5            return this;6        },7        sub: function(num1, num2) {8            this.result = num1 - num2;9            return this;10        },11        mult: function(num1, num2) {12            this.result = num1 * num2;13            return this;14        },15        div: function(num1, num2) {16            this.result = num1 / num2;17            return this;18        },19        print: function() {20            console.log(this.result);21        }22    }23}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!!
