@voxgig/sdkgen 0.35.2 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/cmp/Main.js +0 -12
- package/dist/cmp/Main.js.map +1 -1
- package/dist/cmp/Readme.js +5 -5
- package/dist/cmp/Readme.js.map +1 -1
- package/dist/cmp/ReadmeEntity.js +74 -24
- package/dist/cmp/ReadmeEntity.js.map +1 -1
- package/dist/cmp/ReadmeExplanation.d.ts +2 -0
- package/dist/cmp/ReadmeExplanation.js +308 -0
- package/dist/cmp/ReadmeExplanation.js.map +1 -0
- package/dist/cmp/ReadmeHowto.d.ts +2 -0
- package/dist/cmp/ReadmeHowto.js +18 -0
- package/dist/cmp/ReadmeHowto.js.map +1 -0
- package/dist/cmp/ReadmeIntro.js +8 -23
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/cmp/ReadmeModel.js +55 -91
- package/dist/cmp/ReadmeModel.js.map +1 -1
- package/dist/cmp/ReadmeOptions.js +35 -11
- package/dist/cmp/ReadmeOptions.js.map +1 -1
- package/dist/cmp/ReadmeQuick.js +4 -1
- package/dist/cmp/ReadmeQuick.js.map +1 -1
- package/dist/cmp/ReadmeRef.js +1042 -40
- package/dist/cmp/ReadmeRef.js.map +1 -1
- package/dist/cmp/ReadmeTop.d.ts +2 -0
- package/dist/cmp/ReadmeTop.js +171 -0
- package/dist/cmp/ReadmeTop.js.map +1 -0
- package/dist/sdkgen.d.ts +7 -1
- package/dist/sdkgen.js +13 -1
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/project/.sdk/model/feature/feature-index.jsonic +5 -0
- package/project/.sdk/model/feature/log.jsonic +5 -1
- package/project/.sdk/model/feature/test.jsonic +1 -1
- package/project/.sdk/model/target/lua.jsonic +23 -0
- package/project/.sdk/model/target/php.jsonic +22 -0
- package/project/.sdk/model/target/py.jsonic +23 -0
- package/project/.sdk/model/target/rb.jsonic +23 -0
- package/project/.sdk/src/cmp/go/Config_go.ts +6 -2
- package/project/.sdk/src/cmp/go/Main_go.ts +2 -6
- package/project/.sdk/src/cmp/go/ReadmeExplanation_go.ts +42 -0
- package/project/.sdk/src/cmp/go/ReadmeHowto_go.ts +112 -0
- package/project/.sdk/src/cmp/go/ReadmeInstall_go.ts +29 -0
- package/project/.sdk/src/cmp/go/ReadmeModel_go.ts +129 -0
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +163 -0
- package/project/.sdk/src/cmp/go/ReadmeTopHowto_go.ts +24 -0
- package/project/.sdk/src/cmp/go/ReadmeTopQuick_go.ts +67 -0
- package/project/.sdk/src/cmp/go/ReadmeTopTest_go.ts +40 -0
- package/project/.sdk/src/cmp/go/TestDirect_go.ts +46 -2
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +360 -160
- package/project/.sdk/src/cmp/go/Test_go.ts +24 -1
- package/project/.sdk/src/cmp/js/EntityBase_js.ts +34 -0
- package/project/.sdk/src/cmp/js/Main_js.ts +10 -0
- package/project/.sdk/src/cmp/js/ReadmeExplanation_js.ts +33 -0
- package/project/.sdk/src/cmp/js/ReadmeHowto_js.ts +123 -0
- package/project/.sdk/src/cmp/js/ReadmeModel_js.ts +152 -0
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
- package/project/.sdk/src/cmp/js/ReadmeTopHowto_js.ts +25 -0
- package/project/.sdk/src/cmp/js/ReadmeTopQuick_js.ts +65 -0
- package/project/.sdk/src/cmp/js/ReadmeTopTest_js.ts +36 -0
- package/project/.sdk/src/cmp/js/TestDirect_js.ts +53 -5
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +114 -20
- package/project/.sdk/src/cmp/js/fragment/Entity.fragment.js +7 -139
- package/project/.sdk/src/cmp/js/fragment/EntityBase.fragment.js +149 -0
- package/project/.sdk/src/cmp/js/fragment/EntityCreateOp.fragment.js +6 -10
- package/project/.sdk/src/cmp/js/fragment/EntityListOp.fragment.js +6 -10
- package/project/.sdk/src/cmp/js/fragment/EntityLoadOp.fragment.js +7 -11
- package/project/.sdk/src/cmp/js/fragment/EntityRemoveOp.fragment.js +7 -11
- package/project/.sdk/src/cmp/js/fragment/EntityUpdateOp.fragment.js +7 -11
- package/project/.sdk/src/cmp/js/fragment/Main.fragment.js +2 -0
- package/project/.sdk/src/cmp/js/fragment/SdkError.fragment.js +0 -2
- package/project/.sdk/src/cmp/lua/Config_lua.ts +116 -0
- package/project/.sdk/src/cmp/lua/EntityOperation_lua.ts +44 -0
- package/project/.sdk/src/cmp/lua/Entity_lua.ts +62 -0
- package/project/.sdk/src/cmp/lua/MainEntity_lua.ts +23 -0
- package/project/.sdk/src/cmp/lua/Main_lua.ts +133 -0
- package/project/.sdk/src/cmp/lua/Package_lua.ts +80 -0
- package/project/.sdk/src/cmp/lua/ReadmeExplanation_lua.ts +42 -0
- package/project/.sdk/src/cmp/lua/ReadmeHowto_lua.ts +100 -0
- package/project/.sdk/src/cmp/lua/ReadmeInstall_lua.ts +26 -0
- package/project/.sdk/src/cmp/lua/ReadmeModel_lua.ts +129 -0
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +99 -0
- package/project/.sdk/src/cmp/lua/ReadmeTopHowto_lua.ts +24 -0
- package/project/.sdk/src/cmp/lua/ReadmeTopQuick_lua.ts +55 -0
- package/project/.sdk/src/cmp/lua/ReadmeTopTest_lua.ts +38 -0
- package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +261 -0
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +485 -0
- package/project/.sdk/src/cmp/lua/Test_lua.ts +49 -0
- package/project/.sdk/src/cmp/lua/fragment/Entity.fragment.lua +147 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityCreateOp.fragment.lua +27 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityListOp.fragment.lua +24 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityLoadOp.fragment.lua +30 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityRemoveOp.fragment.lua +30 -0
- package/project/.sdk/src/cmp/lua/fragment/EntityUpdateOp.fragment.lua +30 -0
- package/project/.sdk/src/cmp/lua/fragment/Main.fragment.lua +256 -0
- package/project/.sdk/src/cmp/lua/fragment/SdkError.fragment.lua +26 -0
- package/project/.sdk/src/cmp/lua/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/lua/utility_lua.ts +84 -0
- package/project/.sdk/src/cmp/php/Config_php.ts +111 -0
- package/project/.sdk/src/cmp/php/EntityOperation_php.ts +44 -0
- package/project/.sdk/src/cmp/php/Entity_php.ts +62 -0
- package/project/.sdk/src/cmp/php/MainEntity_php.ts +24 -0
- package/project/.sdk/src/cmp/php/Main_php.ts +135 -0
- package/project/.sdk/src/cmp/php/Package_php.ts +87 -0
- package/project/.sdk/src/cmp/php/ReadmeExplanation_php.ts +42 -0
- package/project/.sdk/src/cmp/php/ReadmeHowto_php.ts +101 -0
- package/project/.sdk/src/cmp/php/ReadmeInstall_php.ts +19 -0
- package/project/.sdk/src/cmp/php/ReadmeModel_php.ts +129 -0
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +100 -0
- package/project/.sdk/src/cmp/php/ReadmeTopHowto_php.ts +24 -0
- package/project/.sdk/src/cmp/php/ReadmeTopQuick_php.ts +56 -0
- package/project/.sdk/src/cmp/php/ReadmeTopTest_php.ts +38 -0
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +270 -0
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +479 -0
- package/project/.sdk/src/cmp/php/Test_php.ts +56 -0
- package/project/.sdk/src/cmp/php/fragment/Entity.fragment.php +146 -0
- package/project/.sdk/src/cmp/php/fragment/EntityCreateOp.fragment.php +26 -0
- package/project/.sdk/src/cmp/php/fragment/EntityListOp.fragment.php +23 -0
- package/project/.sdk/src/cmp/php/fragment/EntityLoadOp.fragment.php +29 -0
- package/project/.sdk/src/cmp/php/fragment/EntityRemoveOp.fragment.php +29 -0
- package/project/.sdk/src/cmp/php/fragment/EntityUpdateOp.fragment.php +29 -0
- package/project/.sdk/src/cmp/php/fragment/Main.fragment.php +233 -0
- package/project/.sdk/src/cmp/php/fragment/SdkError.fragment.php +24 -0
- package/project/.sdk/src/cmp/php/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/php/utility_php.ts +85 -0
- package/project/.sdk/src/cmp/py/Config_py.ts +97 -0
- package/project/.sdk/src/cmp/py/EntityOperation_py.ts +44 -0
- package/project/.sdk/src/cmp/py/Entity_py.ts +62 -0
- package/project/.sdk/src/cmp/py/MainEntity_py.ts +22 -0
- package/project/.sdk/src/cmp/py/Main_py.ts +156 -0
- package/project/.sdk/src/cmp/py/Package_py.ts +75 -0
- package/project/.sdk/src/cmp/py/ReadmeExplanation_py.ts +41 -0
- package/project/.sdk/src/cmp/py/ReadmeHowto_py.ts +98 -0
- package/project/.sdk/src/cmp/py/ReadmeInstall_py.ts +25 -0
- package/project/.sdk/src/cmp/py/ReadmeModel_py.ts +130 -0
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +100 -0
- package/project/.sdk/src/cmp/py/ReadmeTopHowto_py.ts +24 -0
- package/project/.sdk/src/cmp/py/ReadmeTopQuick_py.ts +56 -0
- package/project/.sdk/src/cmp/py/ReadmeTopTest_py.ts +38 -0
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +248 -0
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +477 -0
- package/project/.sdk/src/cmp/py/Test_py.ts +55 -0
- package/project/.sdk/src/cmp/py/fragment/Entity.fragment.py +112 -0
- package/project/.sdk/src/cmp/py/fragment/EntityCreateOp.fragment.py +25 -0
- package/project/.sdk/src/cmp/py/fragment/EntityListOp.fragment.py +22 -0
- package/project/.sdk/src/cmp/py/fragment/EntityLoadOp.fragment.py +27 -0
- package/project/.sdk/src/cmp/py/fragment/EntityRemoveOp.fragment.py +27 -0
- package/project/.sdk/src/cmp/py/fragment/EntityUpdateOp.fragment.py +27 -0
- package/project/.sdk/src/cmp/py/fragment/Main.fragment.py +222 -0
- package/project/.sdk/src/cmp/py/fragment/SdkError.fragment.py +16 -0
- package/project/.sdk/src/cmp/py/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/py/utility_py.ts +84 -0
- package/project/.sdk/src/cmp/rb/Config_rb.ts +105 -0
- package/project/.sdk/src/cmp/rb/EntityOperation_rb.ts +44 -0
- package/project/.sdk/src/cmp/rb/Entity_rb.ts +62 -0
- package/project/.sdk/src/cmp/rb/MainEntity_rb.ts +23 -0
- package/project/.sdk/src/cmp/rb/Main_rb.ts +130 -0
- package/project/.sdk/src/cmp/rb/Package_rb.ts +111 -0
- package/project/.sdk/src/cmp/rb/ReadmeExplanation_rb.ts +42 -0
- package/project/.sdk/src/cmp/rb/ReadmeHowto_rb.ts +98 -0
- package/project/.sdk/src/cmp/rb/ReadmeInstall_rb.ts +31 -0
- package/project/.sdk/src/cmp/rb/ReadmeModel_rb.ts +129 -0
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +99 -0
- package/project/.sdk/src/cmp/rb/ReadmeTopHowto_rb.ts +24 -0
- package/project/.sdk/src/cmp/rb/ReadmeTopQuick_rb.ts +55 -0
- package/project/.sdk/src/cmp/rb/ReadmeTopTest_rb.ts +38 -0
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +260 -0
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +476 -0
- package/project/.sdk/src/cmp/rb/Test_rb.ts +50 -0
- package/project/.sdk/src/cmp/rb/fragment/Entity.fragment.rb +116 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityCreateOp.fragment.rb +25 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityListOp.fragment.rb +20 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityLoadOp.fragment.rb +26 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityRemoveOp.fragment.rb +26 -0
- package/project/.sdk/src/cmp/rb/fragment/EntityUpdateOp.fragment.rb +26 -0
- package/project/.sdk/src/cmp/rb/fragment/Main.fragment.rb +203 -0
- package/project/.sdk/src/cmp/rb/fragment/SdkError.fragment.rb +16 -0
- package/project/.sdk/src/cmp/rb/tsconfig.json +15 -0
- package/project/.sdk/src/cmp/rb/utility_rb.ts +84 -0
- package/project/.sdk/src/cmp/ts/Main_ts.ts +7 -0
- package/project/.sdk/src/cmp/ts/ReadmeExplanation_ts.ts +34 -0
- package/project/.sdk/src/cmp/ts/ReadmeHowto_ts.ts +123 -0
- package/project/.sdk/src/cmp/ts/ReadmeInstall_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/ReadmeModel_ts.ts +159 -0
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +69 -54
- package/project/.sdk/src/cmp/ts/ReadmeTopHowto_ts.ts +25 -0
- package/project/.sdk/src/cmp/ts/ReadmeTopQuick_ts.ts +65 -0
- package/project/.sdk/src/cmp/ts/ReadmeTopTest_ts.ts +36 -0
- package/project/.sdk/tm/go/feature/log_feature.go +133 -0
- package/project/.sdk/tm/go/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/go/test/runner_test.go +16 -2
- package/project/.sdk/tm/js/src/Context.js +142 -0
- package/project/.sdk/tm/js/src/Control.js +16 -0
- package/project/.sdk/tm/js/src/Operation.js +19 -0
- package/project/.sdk/tm/js/src/Point.js +24 -0
- package/project/.sdk/tm/js/src/README.md +1 -0
- package/project/.sdk/tm/js/src/Response.js +19 -0
- package/project/.sdk/tm/js/src/Result.js +21 -0
- package/project/.sdk/tm/js/src/Spec.js +26 -0
- package/project/.sdk/tm/js/src/feature/README.md +1 -0
- package/project/.sdk/tm/js/src/feature/base/BaseFeature.js +45 -0
- package/project/.sdk/tm/js/src/feature/log/LogFeature.js +46 -47
- package/project/.sdk/tm/js/src/feature/test/TestFeature.js +207 -0
- package/project/.sdk/tm/js/src/types.js +22 -0
- package/project/.sdk/tm/js/src/utility/CleanUtility.js +31 -0
- package/project/.sdk/tm/js/src/utility/DoneUtility.js +11 -4
- package/project/.sdk/tm/js/src/utility/FeatureAddUtility.js +42 -0
- package/project/.sdk/tm/js/src/utility/FeatureHookUtility.js +25 -0
- package/project/.sdk/tm/js/src/utility/FeatureInitUtility.js +11 -0
- package/project/.sdk/tm/js/src/utility/FetcherUtility.js +28 -0
- package/project/.sdk/tm/js/src/utility/MakeContextUtility.js +11 -0
- package/project/.sdk/tm/js/src/utility/MakeErrorUtility.js +55 -0
- package/project/.sdk/tm/js/src/utility/MakeFetchDefUtility.js +44 -0
- package/project/.sdk/tm/js/src/utility/MakeOptionsUtility.js +93 -0
- package/project/.sdk/tm/js/src/utility/MakePointUtility.js +77 -0
- package/project/.sdk/tm/js/src/utility/MakeRequestUtility.js +63 -0
- package/project/.sdk/tm/js/src/utility/MakeResponseUtility.js +55 -0
- package/project/.sdk/tm/js/src/utility/MakeResultUtility.js +54 -0
- package/project/.sdk/tm/js/src/utility/MakeSpecUtility.js +58 -0
- package/project/.sdk/tm/js/src/utility/MakeUrlUtility.js +40 -0
- package/project/.sdk/tm/js/src/utility/ParamUtility.js +61 -0
- package/project/.sdk/tm/js/src/utility/PrepareAuthUtility.js +41 -0
- package/project/.sdk/tm/js/src/utility/PrepareBodyUtility.js +25 -0
- package/project/.sdk/tm/js/src/utility/PrepareHeadersUtility.js +18 -0
- package/project/.sdk/tm/js/src/utility/{MethodUtility.js → PrepareMethodUtility.js} +7 -7
- package/project/.sdk/tm/js/src/utility/PrepareParamsUtility.js +25 -0
- package/project/.sdk/tm/js/src/utility/PreparePathUtility.js +13 -0
- package/project/.sdk/tm/js/src/utility/PrepareQueryUtility.js +26 -0
- package/project/.sdk/tm/js/src/utility/README.md +1 -0
- package/project/.sdk/tm/js/src/utility/ResultBasicUtility.js +34 -0
- package/project/.sdk/tm/js/src/utility/ResultBodyUtility.js +18 -0
- package/project/.sdk/tm/js/src/utility/ResultHeadersUtility.js +22 -0
- package/project/.sdk/tm/js/src/utility/StructUtility.js +2219 -1078
- package/project/.sdk/tm/js/src/utility/TransformRequestUtility.js +28 -0
- package/project/.sdk/tm/js/src/utility/TransformResponseUtility.js +31 -0
- package/project/.sdk/tm/js/src/utility/Utility.js +61 -61
- package/project/.sdk/tm/js/test/README.md +1 -0
- package/project/.sdk/tm/js/test/exists.test.js +16 -0
- package/project/.sdk/tm/js/test/runner.js +323 -107
- package/project/.sdk/tm/js/test/utility/Custom.test.js +41 -63
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +390 -116
- package/project/.sdk/tm/js/test/utility/StructUtility.test.js +728 -175
- package/project/.sdk/tm/js/test/utility/index.js +9 -0
- package/project/.sdk/tm/js/test/utility.js +72 -0
- package/project/.sdk/tm/lua/LICENSE +22 -0
- package/project/.sdk/tm/lua/Makefile +10 -0
- package/project/.sdk/tm/lua/core/context.lua +208 -0
- package/project/.sdk/tm/lua/core/control.lua +17 -0
- package/project/.sdk/tm/lua/core/error.lua +30 -0
- package/project/.sdk/tm/lua/core/helpers.lua +30 -0
- package/project/.sdk/tm/lua/core/operation.lua +51 -0
- package/project/.sdk/tm/lua/core/response.lua +45 -0
- package/project/.sdk/tm/lua/core/result.lua +58 -0
- package/project/.sdk/tm/lua/core/spec.lua +29 -0
- package/project/.sdk/tm/lua/core/utility_type.lua +90 -0
- package/project/.sdk/tm/lua/feature/base_feature.lua +35 -0
- package/project/.sdk/tm/lua/feature/log_feature.lua +80 -0
- package/project/.sdk/tm/lua/feature/test_feature.lua +202 -0
- package/project/.sdk/tm/lua/src/feature/README.md +3 -0
- package/project/.sdk/tm/lua/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/lua/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +1213 -0
- package/project/.sdk/tm/lua/test/runner.lua +86 -0
- package/project/.sdk/tm/lua/test/struct_runner.lua +602 -0
- package/project/.sdk/tm/lua/test/struct_utility_test.lua +959 -0
- package/project/.sdk/tm/lua/utility/clean.lua +7 -0
- package/project/.sdk/tm/lua/utility/done.lua +19 -0
- package/project/.sdk/tm/lua/utility/feature_add.lua +8 -0
- package/project/.sdk/tm/lua/utility/feature_hook.lua +21 -0
- package/project/.sdk/tm/lua/utility/feature_init.lua +24 -0
- package/project/.sdk/tm/lua/utility/fetcher.lua +96 -0
- package/project/.sdk/tm/lua/utility/make_context.lua +9 -0
- package/project/.sdk/tm/lua/utility/make_error.lua +73 -0
- package/project/.sdk/tm/lua/utility/make_fetch_def.lua +43 -0
- package/project/.sdk/tm/lua/utility/make_options.lua +116 -0
- package/project/.sdk/tm/lua/utility/make_point.lua +92 -0
- package/project/.sdk/tm/lua/utility/make_request.lua +58 -0
- package/project/.sdk/tm/lua/utility/make_response.lua +44 -0
- package/project/.sdk/tm/lua/utility/make_result.lua +51 -0
- package/project/.sdk/tm/lua/utility/make_spec.lua +72 -0
- package/project/.sdk/tm/lua/utility/make_url.lua +46 -0
- package/project/.sdk/tm/lua/utility/param.lua +68 -0
- package/project/.sdk/tm/lua/utility/prepare_auth.lua +39 -0
- package/project/.sdk/tm/lua/utility/prepare_body.lua +14 -0
- package/project/.sdk/tm/lua/utility/prepare_headers.lua +20 -0
- package/project/.sdk/tm/lua/utility/prepare_method.lua +17 -0
- package/project/.sdk/tm/lua/utility/prepare_params.lua +36 -0
- package/project/.sdk/tm/lua/utility/prepare_path.lua +19 -0
- package/project/.sdk/tm/lua/utility/prepare_query.lua +41 -0
- package/project/.sdk/tm/lua/utility/register.lua +71 -0
- package/project/.sdk/tm/lua/utility/result_basic.lua +32 -0
- package/project/.sdk/tm/lua/utility/result_body.lua +17 -0
- package/project/.sdk/tm/lua/utility/result_headers.lua +22 -0
- package/project/.sdk/tm/lua/utility/struct/struct.lua +3427 -0
- package/project/.sdk/tm/lua/utility/transform_request.lua +31 -0
- package/project/.sdk/tm/lua/utility/transform_response.lua +44 -0
- package/project/.sdk/tm/php/LICENSE +22 -0
- package/project/.sdk/tm/php/Makefile +10 -0
- package/project/.sdk/tm/php/core/Context.php +139 -0
- package/project/.sdk/tm/php/core/Control.php +18 -0
- package/project/.sdk/tm/php/core/Error.php +37 -0
- package/project/.sdk/tm/php/core/Helpers.php +25 -0
- package/project/.sdk/tm/php/core/Operation.php +36 -0
- package/project/.sdk/tm/php/core/Response.php +30 -0
- package/project/.sdk/tm/php/core/Result.php +35 -0
- package/project/.sdk/tm/php/core/Spec.php +38 -0
- package/project/.sdk/tm/php/core/UtilityType.php +89 -0
- package/project/.sdk/tm/php/feature/BaseFeature.php +37 -0
- package/project/.sdk/tm/php/feature/LogFeature.php +65 -0
- package/project/.sdk/tm/php/feature/TestFeature.php +156 -0
- package/project/.sdk/tm/php/src/feature/README.md +3 -0
- package/project/.sdk/tm/php/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/php/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/php/test/PrimaryUtilityTest.php +1309 -0
- package/project/.sdk/tm/php/test/Runner.php +112 -0
- package/project/.sdk/tm/php/test/StructRunner.php +275 -0
- package/project/.sdk/tm/php/test/StructUtilityTest.php +1336 -0
- package/project/.sdk/tm/php/utility/Clean.php +12 -0
- package/project/.sdk/tm/php/utility/Done.php +26 -0
- package/project/.sdk/tm/php/utility/FeatureAdd.php +12 -0
- package/project/.sdk/tm/php/utility/FeatureHook.php +23 -0
- package/project/.sdk/tm/php/utility/FeatureInit.php +25 -0
- package/project/.sdk/tm/php/utility/Fetcher.php +105 -0
- package/project/.sdk/tm/php/utility/MakeContext.php +14 -0
- package/project/.sdk/tm/php/utility/MakeError.php +59 -0
- package/project/.sdk/tm/php/utility/MakeFetchDef.php +36 -0
- package/project/.sdk/tm/php/utility/MakeOptions.php +102 -0
- package/project/.sdk/tm/php/utility/MakePoint.php +87 -0
- package/project/.sdk/tm/php/utility/MakeRequest.php +57 -0
- package/project/.sdk/tm/php/utility/MakeResponse.php +43 -0
- package/project/.sdk/tm/php/utility/MakeResult.php +53 -0
- package/project/.sdk/tm/php/utility/MakeSpec.php +64 -0
- package/project/.sdk/tm/php/utility/MakeUrl.php +41 -0
- package/project/.sdk/tm/php/utility/Param.php +68 -0
- package/project/.sdk/tm/php/utility/PrepareAuth.php +33 -0
- package/project/.sdk/tm/php/utility/PrepareBody.php +15 -0
- package/project/.sdk/tm/php/utility/PrepareHeaders.php +18 -0
- package/project/.sdk/tm/php/utility/PrepareMethod.php +21 -0
- package/project/.sdk/tm/php/utility/PrepareParams.php +34 -0
- package/project/.sdk/tm/php/utility/PreparePath.php +20 -0
- package/project/.sdk/tm/php/utility/PrepareQuery.php +32 -0
- package/project/.sdk/tm/php/utility/Register.php +67 -0
- package/project/.sdk/tm/php/utility/ResultBasic.php +29 -0
- package/project/.sdk/tm/php/utility/ResultBody.php +17 -0
- package/project/.sdk/tm/php/utility/ResultHeaders.php +21 -0
- package/project/.sdk/tm/php/utility/TransformRequest.php +27 -0
- package/project/.sdk/tm/php/utility/TransformResponse.php +42 -0
- package/project/.sdk/tm/php/utility/struct/Struct.php +3535 -0
- package/project/.sdk/tm/py/Makefile +10 -0
- package/project/.sdk/tm/py/core/__init__.py +0 -0
- package/project/.sdk/tm/py/core/context.py +199 -0
- package/project/.sdk/tm/py/core/control.py +12 -0
- package/project/.sdk/tm/py/core/error.py +18 -0
- package/project/.sdk/tm/py/core/helpers.py +15 -0
- package/project/.sdk/tm/py/core/operation.py +37 -0
- package/project/.sdk/tm/py/core/response.py +34 -0
- package/project/.sdk/tm/py/core/result.py +44 -0
- package/project/.sdk/tm/py/core/spec.py +23 -0
- package/project/.sdk/tm/py/core/utility_type.py +82 -0
- package/project/.sdk/tm/py/entity/__init__.py +0 -0
- package/project/.sdk/tm/py/feature/__init__.py +0 -0
- package/project/.sdk/tm/py/feature/base_feature.py +61 -0
- package/project/.sdk/tm/py/feature/log_feature.py +84 -0
- package/project/.sdk/tm/py/feature/test_feature.py +164 -0
- package/project/.sdk/tm/py/src/feature/README.md +3 -0
- package/project/.sdk/tm/py/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/py/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/py/test/__init__.py +0 -0
- package/project/.sdk/tm/py/test/runner.py +90 -0
- package/project/.sdk/tm/py/test/struct_runner.py +411 -0
- package/project/.sdk/tm/py/test/test_primary_utility.py +1101 -0
- package/project/.sdk/tm/py/test/test_struct_utility.py +751 -0
- package/project/.sdk/tm/py/utility/__init__.py +0 -0
- package/project/.sdk/tm/py/utility/clean.py +5 -0
- package/project/.sdk/tm/py/utility/done.py +14 -0
- package/project/.sdk/tm/py/utility/feature_add.py +6 -0
- package/project/.sdk/tm/py/utility/feature_hook.py +15 -0
- package/project/.sdk/tm/py/utility/feature_init.py +18 -0
- package/project/.sdk/tm/py/utility/fetcher.py +95 -0
- package/project/.sdk/tm/py/utility/make_context.py +7 -0
- package/project/.sdk/tm/py/utility/make_error.py +64 -0
- package/project/.sdk/tm/py/utility/make_fetch_def.py +37 -0
- package/project/.sdk/tm/py/utility/make_options.py +103 -0
- package/project/.sdk/tm/py/utility/make_point.py +74 -0
- package/project/.sdk/tm/py/utility/make_request.py +52 -0
- package/project/.sdk/tm/py/utility/make_response.py +36 -0
- package/project/.sdk/tm/py/utility/make_result.py +41 -0
- package/project/.sdk/tm/py/utility/make_spec.py +68 -0
- package/project/.sdk/tm/py/utility/make_url.py +34 -0
- package/project/.sdk/tm/py/utility/param.py +55 -0
- package/project/.sdk/tm/py/utility/prepare_auth.py +34 -0
- package/project/.sdk/tm/py/utility/prepare_body.py +11 -0
- package/project/.sdk/tm/py/utility/prepare_headers.py +17 -0
- package/project/.sdk/tm/py/utility/prepare_method.py +15 -0
- package/project/.sdk/tm/py/utility/prepare_params.py +28 -0
- package/project/.sdk/tm/py/utility/prepare_path.py +16 -0
- package/project/.sdk/tm/py/utility/prepare_query.py +33 -0
- package/project/.sdk/tm/py/utility/register.py +68 -0
- package/project/.sdk/tm/py/utility/result_basic.py +26 -0
- package/project/.sdk/tm/py/utility/result_body.py +13 -0
- package/project/.sdk/tm/py/utility/result_headers.py +17 -0
- package/project/.sdk/tm/py/utility/transform_request.py +27 -0
- package/project/.sdk/tm/py/utility/transform_response.py +39 -0
- package/project/.sdk/tm/py/utility/voxgig_struct/__init__.py +72 -0
- package/project/.sdk/tm/py/utility/voxgig_struct/voxgig_struct.py +2770 -0
- package/project/.sdk/tm/rb/Gemfile +4 -0
- package/project/.sdk/tm/rb/LICENSE +22 -0
- package/project/.sdk/tm/rb/Makefile +10 -0
- package/project/.sdk/tm/rb/core/context.rb +105 -0
- package/project/.sdk/tm/rb/core/control.rb +11 -0
- package/project/.sdk/tm/rb/core/error.rb +24 -0
- package/project/.sdk/tm/rb/core/helpers.rb +16 -0
- package/project/.sdk/tm/rb/core/operation.rb +26 -0
- package/project/.sdk/tm/rb/core/response.rb +20 -0
- package/project/.sdk/tm/rb/core/result.rb +23 -0
- package/project/.sdk/tm/rb/core/spec.rb +23 -0
- package/project/.sdk/tm/rb/core/utility_type.rb +32 -0
- package/project/.sdk/tm/rb/feature/base_feature.rb +30 -0
- package/project/.sdk/tm/rb/feature/log_feature.rb +50 -0
- package/project/.sdk/tm/rb/feature/test_feature.rb +154 -0
- package/project/.sdk/tm/rb/src/feature/README.md +3 -0
- package/project/.sdk/tm/rb/src/feature/base/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/log/.gitkeep +0 -0
- package/project/.sdk/tm/rb/src/feature/test/.gitkeep +0 -0
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +1083 -0
- package/project/.sdk/tm/rb/test/runner.rb +70 -0
- package/project/.sdk/tm/rb/test/struct_runner.rb +309 -0
- package/project/.sdk/tm/rb/test/struct_utility_test.rb +670 -0
- package/project/.sdk/tm/rb/utility/clean.rb +4 -0
- package/project/.sdk/tm/rb/utility/done.rb +14 -0
- package/project/.sdk/tm/rb/utility/feature_add.rb +6 -0
- package/project/.sdk/tm/rb/utility/feature_hook.rb +11 -0
- package/project/.sdk/tm/rb/utility/feature_init.rb +16 -0
- package/project/.sdk/tm/rb/utility/fetcher.rb +67 -0
- package/project/.sdk/tm/rb/utility/make_context.rb +7 -0
- package/project/.sdk/tm/rb/utility/make_error.rb +44 -0
- package/project/.sdk/tm/rb/utility/make_fetch_def.rb +24 -0
- package/project/.sdk/tm/rb/utility/make_options.rb +57 -0
- package/project/.sdk/tm/rb/utility/make_point.rb +77 -0
- package/project/.sdk/tm/rb/utility/make_request.rb +44 -0
- package/project/.sdk/tm/rb/utility/make_response.rb +25 -0
- package/project/.sdk/tm/rb/utility/make_result.rb +33 -0
- package/project/.sdk/tm/rb/utility/make_spec.rb +50 -0
- package/project/.sdk/tm/rb/utility/make_url.rb +32 -0
- package/project/.sdk/tm/rb/utility/param.rb +48 -0
- package/project/.sdk/tm/rb/utility/prepare_auth.rb +26 -0
- package/project/.sdk/tm/rb/utility/prepare_body.rb +6 -0
- package/project/.sdk/tm/rb/utility/prepare_headers.rb +11 -0
- package/project/.sdk/tm/rb/utility/prepare_method.rb +5 -0
- package/project/.sdk/tm/rb/utility/prepare_params.rb +25 -0
- package/project/.sdk/tm/rb/utility/prepare_path.rb +13 -0
- package/project/.sdk/tm/rb/utility/prepare_query.rb +22 -0
- package/project/.sdk/tm/rb/utility/register.rb +63 -0
- package/project/.sdk/tm/rb/utility/result_basic.rb +23 -0
- package/project/.sdk/tm/rb/utility/result_body.rb +11 -0
- package/project/.sdk/tm/rb/utility/result_headers.rb +15 -0
- package/project/.sdk/tm/rb/utility/struct/voxgig_struct.rb +2256 -0
- package/project/.sdk/tm/rb/utility/transform_request.rb +15 -0
- package/project/.sdk/tm/rb/utility/transform_response.rb +23 -0
- package/src/cmp/Main.ts +1 -16
- package/src/cmp/Readme.ts +5 -5
- package/src/cmp/ReadmeEntity.ts +77 -25
- package/src/cmp/ReadmeExplanation.ts +333 -0
- package/src/cmp/ReadmeHowto.ts +28 -0
- package/src/cmp/ReadmeIntro.ts +10 -24
- package/src/cmp/ReadmeModel.ts +57 -88
- package/src/cmp/ReadmeOptions.ts +40 -11
- package/src/cmp/ReadmeQuick.ts +4 -1
- package/src/cmp/ReadmeRef.ts +1057 -40
- package/src/cmp/ReadmeTop.ts +213 -0
- package/src/sdkgen.ts +12 -0
- package/project/.sdk/src/cmp/js/Quick_js.ts +0 -78
- package/project/.sdk/src/cmp/js/TestAcceptEntity_js.ts +0 -13
- package/project/.sdk/src/cmp/js/TestAccept_js.ts +0 -18
- package/project/.sdk/tm/go/test/exists_test.go +0 -16
- package/project/.sdk/tm/js/src/utility/AuthUtility.js +0 -21
- package/project/.sdk/tm/js/src/utility/BodyUtility.js +0 -29
- package/project/.sdk/tm/js/src/utility/ErrorUtility.js +0 -33
- package/project/.sdk/tm/js/src/utility/FindparamUtility.js +0 -31
- package/project/.sdk/tm/js/src/utility/FullurlUtility.js +0 -39
- package/project/.sdk/tm/js/src/utility/HeadersUtility.js +0 -13
- package/project/.sdk/tm/js/src/utility/JoinurlUtility.js +0 -14
- package/project/.sdk/tm/js/src/utility/OperatorUtility.js +0 -44
- package/project/.sdk/tm/js/src/utility/OptionsUtility.js +0 -54
- package/project/.sdk/tm/js/src/utility/ParamsUtility.js +0 -21
- package/project/.sdk/tm/js/src/utility/QueryUtility.js +0 -21
- package/project/.sdk/tm/js/src/utility/ReqformUtility.js +0 -32
- package/project/.sdk/tm/js/src/utility/RequestUtility.js +0 -48
- package/project/.sdk/tm/js/src/utility/ResbasicUtility.js +0 -27
- package/project/.sdk/tm/js/src/utility/ResbodyUtility.js +0 -15
- package/project/.sdk/tm/js/src/utility/ResformUtility.js +0 -34
- package/project/.sdk/tm/js/src/utility/ResheadersUtility.js +0 -19
- package/project/.sdk/tm/js/src/utility/ResponseUtility.js +0 -37
- package/project/.sdk/tm/js/src/utility/ResultUtility.js +0 -28
- package/project/.sdk/tm/js/src/utility/SpecUtility.js +0 -35
|
@@ -0,0 +1,751 @@
|
|
|
1
|
+
# Vendored from voxgig/struct/py
|
|
2
|
+
# RUN: python -m unittest discover -s tests
|
|
3
|
+
# RUN-SOME: python -m unittest discover -s tests -k getpath
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import unittest
|
|
7
|
+
|
|
8
|
+
from test.struct_runner import (
|
|
9
|
+
makeRunner,
|
|
10
|
+
nullModifier,
|
|
11
|
+
NULLMARK,
|
|
12
|
+
UNDEFMARK,
|
|
13
|
+
StructTestClient,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
from utility.voxgig_struct import voxgig_struct as vs
|
|
17
|
+
from utility.voxgig_struct.voxgig_struct import (
|
|
18
|
+
T_noval, T_scalar, T_function, T_symbol, T_any, T_node, T_instance, T_null,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
STRUCT_TEST_JSON = os.path.join(
|
|
23
|
+
os.path.dirname(os.path.abspath(__file__)), '../../.sdk/test/test.json')
|
|
24
|
+
|
|
25
|
+
sdk_client = StructTestClient.test()
|
|
26
|
+
runner = makeRunner(STRUCT_TEST_JSON, sdk_client)
|
|
27
|
+
runparts = runner('struct')
|
|
28
|
+
|
|
29
|
+
spec = runparts["spec"]
|
|
30
|
+
runset = runparts["runset"]
|
|
31
|
+
runsetflags = runparts["runsetflags"]
|
|
32
|
+
client = runparts["client"]
|
|
33
|
+
|
|
34
|
+
# Get all the struct utilities from the client
|
|
35
|
+
struct_utils = client.utility().struct
|
|
36
|
+
clone = struct_utils.clone
|
|
37
|
+
delprop = struct_utils.delprop
|
|
38
|
+
escre = struct_utils.escre
|
|
39
|
+
escurl = struct_utils.escurl
|
|
40
|
+
filter_fn = struct_utils.filter
|
|
41
|
+
flatten = struct_utils.flatten
|
|
42
|
+
getelem = struct_utils.getelem
|
|
43
|
+
getpath = struct_utils.getpath
|
|
44
|
+
getprop = struct_utils.getprop
|
|
45
|
+
haskey = struct_utils.haskey
|
|
46
|
+
inject = struct_utils.inject
|
|
47
|
+
isempty = struct_utils.isempty
|
|
48
|
+
isfunc = struct_utils.isfunc
|
|
49
|
+
iskey = struct_utils.iskey
|
|
50
|
+
islist = struct_utils.islist
|
|
51
|
+
ismap = struct_utils.ismap
|
|
52
|
+
isnode = struct_utils.isnode
|
|
53
|
+
items = struct_utils.items
|
|
54
|
+
ja = struct_utils.ja
|
|
55
|
+
jo = struct_utils.jo
|
|
56
|
+
joinurl = struct_utils.joinurl
|
|
57
|
+
jsonify = struct_utils.jsonify
|
|
58
|
+
keysof = struct_utils.keysof
|
|
59
|
+
merge = struct_utils.merge
|
|
60
|
+
pad = struct_utils.pad
|
|
61
|
+
pathify = struct_utils.pathify
|
|
62
|
+
select = struct_utils.select
|
|
63
|
+
setpath = struct_utils.setpath
|
|
64
|
+
setprop = struct_utils.setprop
|
|
65
|
+
DELETE = struct_utils.DELETE
|
|
66
|
+
size = struct_utils.size
|
|
67
|
+
slice = struct_utils.slice
|
|
68
|
+
stringify = struct_utils.stringify
|
|
69
|
+
strkey = struct_utils.strkey
|
|
70
|
+
transform = struct_utils.transform
|
|
71
|
+
typename = struct_utils.typename
|
|
72
|
+
typify = struct_utils.typify
|
|
73
|
+
validate = struct_utils.validate
|
|
74
|
+
walk = struct_utils.walk
|
|
75
|
+
|
|
76
|
+
minorSpec = spec["minor"]
|
|
77
|
+
walkSpec = spec["walk"]
|
|
78
|
+
mergeSpec = spec["merge"]
|
|
79
|
+
getpathSpec = spec["getpath"]
|
|
80
|
+
injectSpec = spec["inject"]
|
|
81
|
+
transformSpec = spec["transform"]
|
|
82
|
+
validateSpec = spec["validate"]
|
|
83
|
+
selectSpec = spec["select"]
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class TestStructUtility(unittest.TestCase):
|
|
87
|
+
|
|
88
|
+
# minor tests
|
|
89
|
+
# ===========
|
|
90
|
+
|
|
91
|
+
def test_exists(self):
|
|
92
|
+
self.assertTrue(callable(clone))
|
|
93
|
+
self.assertTrue(callable(escre))
|
|
94
|
+
self.assertTrue(callable(escurl))
|
|
95
|
+
self.assertTrue(callable(getprop))
|
|
96
|
+
self.assertTrue(callable(getpath))
|
|
97
|
+
|
|
98
|
+
self.assertTrue(callable(haskey))
|
|
99
|
+
self.assertTrue(callable(inject))
|
|
100
|
+
self.assertTrue(callable(isempty))
|
|
101
|
+
self.assertTrue(callable(isfunc))
|
|
102
|
+
self.assertTrue(callable(iskey))
|
|
103
|
+
|
|
104
|
+
self.assertTrue(callable(islist))
|
|
105
|
+
self.assertTrue(callable(ismap))
|
|
106
|
+
self.assertTrue(callable(isnode))
|
|
107
|
+
self.assertTrue(callable(items))
|
|
108
|
+
self.assertTrue(callable(joinurl))
|
|
109
|
+
|
|
110
|
+
self.assertTrue(callable(keysof))
|
|
111
|
+
self.assertTrue(callable(merge))
|
|
112
|
+
self.assertTrue(callable(pathify))
|
|
113
|
+
self.assertTrue(callable(setprop))
|
|
114
|
+
self.assertTrue(callable(strkey))
|
|
115
|
+
|
|
116
|
+
self.assertTrue(callable(stringify))
|
|
117
|
+
self.assertTrue(callable(transform))
|
|
118
|
+
self.assertTrue(callable(typify))
|
|
119
|
+
self.assertTrue(callable(validate))
|
|
120
|
+
self.assertTrue(callable(walk))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def test_minor_isnode(self):
|
|
124
|
+
runset(minorSpec["isnode"], isnode)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def test_minor_ismap(self):
|
|
128
|
+
runset(minorSpec["ismap"], ismap)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def test_minor_islist(self):
|
|
132
|
+
runset(minorSpec["islist"], islist)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def test_minor_iskey(self):
|
|
136
|
+
runsetflags(minorSpec["iskey"], {"null": False}, iskey)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def test_minor_strkey(self):
|
|
140
|
+
runsetflags(minorSpec["strkey"], {"null": False}, strkey)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def test_minor_isempty(self):
|
|
144
|
+
runsetflags(minorSpec["isempty"], {"null": False}, isempty)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def test_minor_isfunc(self):
|
|
148
|
+
runset(minorSpec["isfunc"], isfunc)
|
|
149
|
+
def f0():
|
|
150
|
+
return None
|
|
151
|
+
self.assertTrue(isfunc(f0))
|
|
152
|
+
self.assertTrue(isfunc(lambda: None))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def test_minor_clone(self):
|
|
156
|
+
runsetflags(minorSpec["clone"], {"null": False}, clone)
|
|
157
|
+
def f0():
|
|
158
|
+
return None
|
|
159
|
+
self.assertEqual({"a":f0}, clone({"a":f0}))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
def test_minor_escre(self):
|
|
163
|
+
runset(minorSpec["escre"], escre)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def test_minor_escurl(self):
|
|
167
|
+
runset(minorSpec["escurl"], escurl)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def test_minor_stringify(self):
|
|
171
|
+
runset(minorSpec["stringify"],
|
|
172
|
+
lambda vin: stringify("null" if NULLMARK == vin.get('val') else
|
|
173
|
+
vin.get('val'), vin.get('max')))
|
|
174
|
+
|
|
175
|
+
def test_minor_jsonify(self):
|
|
176
|
+
runsetflags(minorSpec["jsonify"], {"null": False},
|
|
177
|
+
lambda vin: jsonify(vin.get("val"), vin.get("flags")))
|
|
178
|
+
|
|
179
|
+
def test_minor_getelem(self):
|
|
180
|
+
def getelem_wrapper(vin):
|
|
181
|
+
if vin.get("alt") is None:
|
|
182
|
+
return getelem(vin.get("val"), vin.get("key"))
|
|
183
|
+
else:
|
|
184
|
+
return getelem(vin.get("val"), vin.get("key"), vin.get("alt"))
|
|
185
|
+
runsetflags(minorSpec["getelem"], {"null": False}, getelem_wrapper)
|
|
186
|
+
|
|
187
|
+
def test_minor_delprop(self):
|
|
188
|
+
def delprop_wrapper(vin):
|
|
189
|
+
return delprop(vin.get("parent"), vin.get("key"))
|
|
190
|
+
runset(minorSpec["delprop"], delprop_wrapper)
|
|
191
|
+
|
|
192
|
+
def test_minor_edge_clone(self):
|
|
193
|
+
x = {"y": 1}
|
|
194
|
+
xc = clone(x)
|
|
195
|
+
self.assertEqual(x, xc)
|
|
196
|
+
self.assertIsNot(x, xc)
|
|
197
|
+
|
|
198
|
+
def test_minor_edge_items(self):
|
|
199
|
+
a0 = [11, 22, 33]
|
|
200
|
+
self.assertEqual(items(a0), [['0', 11], ['1', 22], ['2', 33]])
|
|
201
|
+
|
|
202
|
+
def test_minor_edge_getelem(self):
|
|
203
|
+
self.assertEqual(getelem([], 1, lambda: 2), 2)
|
|
204
|
+
|
|
205
|
+
def test_minor_edge_jsonify(self):
|
|
206
|
+
self.assertEqual(jsonify(lambda: 1), 'null')
|
|
207
|
+
|
|
208
|
+
def test_minor_edge_keysof(self):
|
|
209
|
+
a0 = [11, 22, 33]
|
|
210
|
+
self.assertEqual(keysof(a0), ['0', '1', '2'])
|
|
211
|
+
|
|
212
|
+
def test_minor_edge_stringify(self):
|
|
213
|
+
a = {}
|
|
214
|
+
a["a"] = a
|
|
215
|
+
self.assertEqual(stringify(a), '__STRINGIFY_FAILED__')
|
|
216
|
+
|
|
217
|
+
self.assertEqual(stringify({"a": [9]}, -1, True),
|
|
218
|
+
'\x1b[38;5;81m\x1b[38;5;118m{\x1b[38;5;118ma\x1b[38;5;118m:'
|
|
219
|
+
'\x1b[38;5;213m[\x1b[38;5;213m9\x1b[38;5;213m]\x1b[38;5;118m}\x1b[0m')
|
|
220
|
+
|
|
221
|
+
def test_minor_edge_delprop(self):
|
|
222
|
+
# String array tests
|
|
223
|
+
strarr0 = ['a', 'b', 'c', 'd', 'e']
|
|
224
|
+
strarr1 = ['a', 'b', 'c', 'd', 'e']
|
|
225
|
+
self.assertEqual(delprop(strarr0, 2), ['a', 'b', 'd', 'e'])
|
|
226
|
+
self.assertEqual(delprop(strarr1, '2'), ['a', 'b', 'd', 'e'])
|
|
227
|
+
|
|
228
|
+
# Integer array tests
|
|
229
|
+
intarr0 = [2, 3, 5, 7, 11]
|
|
230
|
+
intarr1 = [2, 3, 5, 7, 11]
|
|
231
|
+
self.assertEqual(delprop(intarr0, 2), [2, 3, 7, 11])
|
|
232
|
+
self.assertEqual(delprop(intarr1, '2'), [2, 3, 7, 11])
|
|
233
|
+
|
|
234
|
+
def test_minor_size(self):
|
|
235
|
+
runsetflags(minorSpec["size"], {"null": False}, size)
|
|
236
|
+
|
|
237
|
+
def test_minor_slice(self):
|
|
238
|
+
def slice_wrapper(vin):
|
|
239
|
+
return slice(vin.get("val"), vin.get("start"), vin.get("end"))
|
|
240
|
+
runsetflags(minorSpec["slice"], {"null": False}, slice_wrapper)
|
|
241
|
+
|
|
242
|
+
def test_minor_pad(self):
|
|
243
|
+
def pad_wrapper(vin):
|
|
244
|
+
return pad(vin.get("val"), vin.get("pad"), vin.get("char"))
|
|
245
|
+
runsetflags(minorSpec["pad"], {"null": False}, pad_wrapper)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def test_minor_pathify(self):
|
|
249
|
+
def pathify_wrapper(vin=None):
|
|
250
|
+
path = vin.get("path")
|
|
251
|
+
path = None if NULLMARK == path else path
|
|
252
|
+
pathstr = pathify(path, vin.get("from")).replace("__NULL__.","")
|
|
253
|
+
pathstr = pathstr.replace(">", ":null>") if NULLMARK == vin.get('path') else pathstr
|
|
254
|
+
return pathstr
|
|
255
|
+
runsetflags(minorSpec["pathify"], {"null": True}, pathify_wrapper)
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def test_minor_items(self):
|
|
259
|
+
runset(minorSpec["items"], items)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def test_minor_getprop(self):
|
|
263
|
+
def getprop_wrapper(vin):
|
|
264
|
+
if vin.get("alt") is None:
|
|
265
|
+
return getprop(vin.get("val"), vin.get("key"))
|
|
266
|
+
else:
|
|
267
|
+
return getprop(vin.get("val"), vin.get("key"), vin.get("alt"))
|
|
268
|
+
runsetflags(minorSpec["getprop"], {"null": False}, getprop_wrapper)
|
|
269
|
+
|
|
270
|
+
def test_minor_edge_getprop(self):
|
|
271
|
+
# String array tests
|
|
272
|
+
strarr = ['a', 'b', 'c', 'd', 'e']
|
|
273
|
+
self.assertEqual(getprop(strarr, 2), 'c')
|
|
274
|
+
self.assertEqual(getprop(strarr, '2'), 'c')
|
|
275
|
+
|
|
276
|
+
# Integer array tests
|
|
277
|
+
intarr = [2, 3, 5, 7, 11]
|
|
278
|
+
self.assertEqual(getprop(intarr, 2), 5)
|
|
279
|
+
self.assertEqual(getprop(intarr, '2'), 5)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def test_minor_setprop(self):
|
|
283
|
+
runset(minorSpec["setprop"],
|
|
284
|
+
lambda vin: setprop(vin.get("parent"), vin.get("key"), vin.get("val")))
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def test_minor_edge_setprop(self):
|
|
288
|
+
# String array tests
|
|
289
|
+
strarr0 = ['a', 'b', 'c', 'd', 'e']
|
|
290
|
+
strarr1 = ['a', 'b', 'c', 'd', 'e']
|
|
291
|
+
self.assertEqual(setprop(strarr0, 2, 'C'), ['a', 'b', 'C', 'd', 'e'])
|
|
292
|
+
self.assertEqual(setprop(strarr1, '2', 'CC'), ['a', 'b', 'CC', 'd', 'e'])
|
|
293
|
+
|
|
294
|
+
# Integer array tests
|
|
295
|
+
intarr0 = [2, 3, 5, 7, 11]
|
|
296
|
+
intarr1 = [2, 3, 5, 7, 11]
|
|
297
|
+
self.assertEqual(setprop(intarr0, 2, 55), [2, 3, 55, 7, 11])
|
|
298
|
+
self.assertEqual(setprop(intarr1, '2', 555), [2, 3, 555, 7, 11])
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def test_minor_haskey(self):
|
|
302
|
+
runsetflags(minorSpec["haskey"], {"null": False},
|
|
303
|
+
lambda vin: haskey(vin.get("src"), vin.get("key")))
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
def test_minor_keysof(self):
|
|
307
|
+
runset(minorSpec["keysof"], keysof)
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def test_minor_joinurl(self):
|
|
311
|
+
from utility.voxgig_struct.voxgig_struct import join as struct_join
|
|
312
|
+
runsetflags(minorSpec["join"], {"null": False},
|
|
313
|
+
lambda vin: struct_join(vin.get("val"), vin.get("sep"), vin.get("url")))
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def test_minor_typify(self):
|
|
317
|
+
runsetflags(minorSpec["typify"], {"null": False}, typify)
|
|
318
|
+
|
|
319
|
+
def test_minor_edge_typify(self):
|
|
320
|
+
self.assertEqual(typify(), T_noval)
|
|
321
|
+
self.assertEqual(typify(None), T_scalar | T_null)
|
|
322
|
+
self.assertEqual(typify(float('nan')), T_noval)
|
|
323
|
+
self.assertEqual(typify(lambda: None), T_scalar | T_function)
|
|
324
|
+
|
|
325
|
+
def test_minor_setpath(self):
|
|
326
|
+
runsetflags(minorSpec["setpath"], {"null": False},
|
|
327
|
+
lambda vin: setpath(vin.get("store"), vin.get("path"), vin.get("val")))
|
|
328
|
+
|
|
329
|
+
def test_minor_edge_setpath(self):
|
|
330
|
+
x = {"y": {"z": 1, "q": 2}}
|
|
331
|
+
self.assertEqual(setpath(x, 'y.q', DELETE), {"z": 1})
|
|
332
|
+
self.assertEqual(x, {"y": {"z": 1}})
|
|
333
|
+
|
|
334
|
+
def test_minor_filter(self):
|
|
335
|
+
checkmap = {
|
|
336
|
+
'gt3': lambda n: n[1] > 3,
|
|
337
|
+
'lt3': lambda n: n[1] < 3,
|
|
338
|
+
}
|
|
339
|
+
runset(minorSpec["filter"],
|
|
340
|
+
lambda vin: filter_fn(vin.get("val"), checkmap[vin.get("check")]))
|
|
341
|
+
|
|
342
|
+
def test_minor_typename(self):
|
|
343
|
+
runset(minorSpec["typename"], typename)
|
|
344
|
+
|
|
345
|
+
def test_minor_flatten(self):
|
|
346
|
+
runset(minorSpec["flatten"],
|
|
347
|
+
lambda vin: flatten(vin.get("val"), vin.get("depth")))
|
|
348
|
+
|
|
349
|
+
# walk tests
|
|
350
|
+
# ==========
|
|
351
|
+
|
|
352
|
+
def test_walk_log(self):
|
|
353
|
+
test_data = clone(walkSpec["log"])
|
|
354
|
+
|
|
355
|
+
log = []
|
|
356
|
+
|
|
357
|
+
def walklog(key, val, parent, path):
|
|
358
|
+
log.append('k=' + stringify(key) +
|
|
359
|
+
', v=' + stringify(val) +
|
|
360
|
+
', p=' + stringify(parent) +
|
|
361
|
+
', t=' + pathify(path))
|
|
362
|
+
return val
|
|
363
|
+
|
|
364
|
+
# Test after callback (Python walk only supports after, not before)
|
|
365
|
+
# TODO: Python walk() needs to be updated to support before/after callbacks like TypeScript
|
|
366
|
+
walk(test_data["in"], walklog)
|
|
367
|
+
self.assertEqual(log, test_data["out"]["after"])
|
|
368
|
+
|
|
369
|
+
def test_walk_basic(self):
|
|
370
|
+
def walkpath(_key, val, _parent, path):
|
|
371
|
+
if isinstance(val, str):
|
|
372
|
+
return val + '~' + '.'.join(str(p) for p in path)
|
|
373
|
+
return val
|
|
374
|
+
|
|
375
|
+
def walk_wrapper(vin=None):
|
|
376
|
+
return walk(vin, walkpath)
|
|
377
|
+
|
|
378
|
+
runset(walkSpec["basic"], walk_wrapper)
|
|
379
|
+
|
|
380
|
+
def test_walk_copy(self):
|
|
381
|
+
cur = [None]
|
|
382
|
+
|
|
383
|
+
def walkcopy(key, val, _parent, path):
|
|
384
|
+
if key is None:
|
|
385
|
+
cur[0] = [None]
|
|
386
|
+
cur[0][0] = {} if ismap(val) else [] if islist(val) else val
|
|
387
|
+
return val
|
|
388
|
+
|
|
389
|
+
v = val
|
|
390
|
+
i = size(path)
|
|
391
|
+
|
|
392
|
+
if isnode(v):
|
|
393
|
+
while len(cur[0]) <= i:
|
|
394
|
+
cur[0].append(None)
|
|
395
|
+
v = cur[0][i] = {} if ismap(v) else []
|
|
396
|
+
|
|
397
|
+
setprop(cur[0][i - 1], key, v)
|
|
398
|
+
|
|
399
|
+
return val
|
|
400
|
+
|
|
401
|
+
def walk_copy_wrapper(vin=None):
|
|
402
|
+
walk(vin, before=walkcopy)
|
|
403
|
+
return cur[0][0]
|
|
404
|
+
|
|
405
|
+
runset(walkSpec["copy"], walk_copy_wrapper)
|
|
406
|
+
|
|
407
|
+
def test_walk_depth(self):
|
|
408
|
+
def walk_depth_wrapper(vin):
|
|
409
|
+
state = {'top': None, 'cur': None}
|
|
410
|
+
|
|
411
|
+
def copy(key, val, _parent, _path):
|
|
412
|
+
if key is None or isnode(val):
|
|
413
|
+
child = [] if islist(val) else {}
|
|
414
|
+
if key is None:
|
|
415
|
+
state['top'] = state['cur'] = child
|
|
416
|
+
else:
|
|
417
|
+
state['cur'][key] = child
|
|
418
|
+
state['cur'] = child
|
|
419
|
+
else:
|
|
420
|
+
state['cur'][key] = val
|
|
421
|
+
return val
|
|
422
|
+
|
|
423
|
+
walk(vin.get("src"), before=copy, maxdepth=vin.get("maxdepth"))
|
|
424
|
+
return state['top']
|
|
425
|
+
|
|
426
|
+
runsetflags(walkSpec["depth"], {"null": False}, walk_depth_wrapper)
|
|
427
|
+
|
|
428
|
+
# merge tests
|
|
429
|
+
# ===========
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
def test_merge_basic(self):
|
|
434
|
+
test_data = clone(spec["merge"]["basic"])
|
|
435
|
+
self.assertEqual(merge(test_data["in"]), test_data["out"])
|
|
436
|
+
|
|
437
|
+
def test_merge_cases(self):
|
|
438
|
+
runset(spec["merge"]["cases"], merge)
|
|
439
|
+
|
|
440
|
+
def test_merge_array(self):
|
|
441
|
+
runset(spec["merge"]["array"], merge)
|
|
442
|
+
|
|
443
|
+
def test_merge_integrity(self):
|
|
444
|
+
runset(spec["merge"]["integrity"], merge)
|
|
445
|
+
|
|
446
|
+
def test_merge_depth(self):
|
|
447
|
+
runset(spec["merge"]["depth"],
|
|
448
|
+
lambda vin: merge(vin.get("val"), vin.get("depth")))
|
|
449
|
+
|
|
450
|
+
def test_merge_special(self):
|
|
451
|
+
def f0():
|
|
452
|
+
return None
|
|
453
|
+
self.assertEqual(merge([f0]), f0)
|
|
454
|
+
self.assertEqual(merge([None, f0]), f0)
|
|
455
|
+
self.assertEqual(merge([{"a": f0}]), {"a": f0})
|
|
456
|
+
self.assertEqual(merge([[f0]]), [f0])
|
|
457
|
+
self.assertEqual(merge([{"a": {"b": f0}}]), {"a": {"b": f0}})
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
# -------------------------------------------------
|
|
461
|
+
# getpath tests
|
|
462
|
+
# -------------------------------------------------
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
def test_getpath_basic(self):
|
|
467
|
+
def getpath_wrapper(vin):
|
|
468
|
+
return getpath(vin.get("store"), vin.get("path"))
|
|
469
|
+
runset(spec["getpath"]["basic"], getpath_wrapper)
|
|
470
|
+
|
|
471
|
+
def test_getpath_relative(self):
|
|
472
|
+
def getpath_wrapper(vin):
|
|
473
|
+
dpath = vin.get("dpath")
|
|
474
|
+
if dpath:
|
|
475
|
+
dpath = dpath.split('.')
|
|
476
|
+
injdef = {"dparent": vin.get("dparent"), "dpath": dpath}
|
|
477
|
+
return getpath(vin.get("store"), vin.get("path"), injdef)
|
|
478
|
+
runset(spec["getpath"]["relative"], getpath_wrapper)
|
|
479
|
+
|
|
480
|
+
def test_getpath_special(self):
|
|
481
|
+
def getpath_wrapper(vin):
|
|
482
|
+
return getpath(vin.get("store"), vin.get("path"), vin.get("inj"))
|
|
483
|
+
runset(spec["getpath"]["special"], getpath_wrapper)
|
|
484
|
+
|
|
485
|
+
def test_getpath_handler(self):
|
|
486
|
+
def getpath_wrapper(vin):
|
|
487
|
+
def handler(inj, val, ref, store):
|
|
488
|
+
return val() if callable(val) else val
|
|
489
|
+
|
|
490
|
+
return getpath({
|
|
491
|
+
"$TOP": vin.get("store"),
|
|
492
|
+
"$FOO": lambda: "foo"
|
|
493
|
+
}, vin.get("path"), {"handler": handler})
|
|
494
|
+
runset(spec["getpath"]["handler"], getpath_wrapper)
|
|
495
|
+
|
|
496
|
+
# -------------------------------------------------
|
|
497
|
+
# inject tests
|
|
498
|
+
# -------------------------------------------------
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
def test_inject_basic(self):
|
|
503
|
+
test_data = clone(spec["inject"]["basic"])
|
|
504
|
+
self.assertEqual(
|
|
505
|
+
inject(test_data["in"]["val"], test_data["in"]["store"]),
|
|
506
|
+
test_data["out"]
|
|
507
|
+
)
|
|
508
|
+
|
|
509
|
+
def test_inject_string(self):
|
|
510
|
+
def inject_wrapper(vin):
|
|
511
|
+
return inject(vin.get("val"), vin.get("store"), {"modify": nullModifier, "extra": vin.get("current")})
|
|
512
|
+
runset(spec["inject"]["string"], inject_wrapper)
|
|
513
|
+
|
|
514
|
+
def test_inject_deep(self):
|
|
515
|
+
runset(spec["inject"]["deep"], lambda vin: inject(vin.get("val"), vin.get("store")))
|
|
516
|
+
|
|
517
|
+
# -------------------------------------------------
|
|
518
|
+
# transform tests
|
|
519
|
+
# Inputs and expected outputs: build/test/transform.jsonic
|
|
520
|
+
# -------------------------------------------------
|
|
521
|
+
|
|
522
|
+
def test_transform_basic(self):
|
|
523
|
+
test_data = clone(spec["transform"]["basic"])
|
|
524
|
+
test_data_in = test_data.get("in")
|
|
525
|
+
self.assertEqual(
|
|
526
|
+
transform(
|
|
527
|
+
test_data_in.get("data"),
|
|
528
|
+
test_data_in.get("spec"),
|
|
529
|
+
test_data_in.get("store")
|
|
530
|
+
),
|
|
531
|
+
test_data["out"]
|
|
532
|
+
)
|
|
533
|
+
|
|
534
|
+
def test_transform_paths(self):
|
|
535
|
+
def transform_wrapper(vin):
|
|
536
|
+
return transform(vin.get("data"), vin.get("spec"), vin.get("store"))
|
|
537
|
+
runset(spec["transform"]["paths"], transform_wrapper)
|
|
538
|
+
|
|
539
|
+
def test_transform_cmds(self):
|
|
540
|
+
def transform_wrapper(vin):
|
|
541
|
+
return transform(vin.get("data"), vin.get("spec"), vin.get("store"))
|
|
542
|
+
runset(spec["transform"]["cmds"], transform_wrapper)
|
|
543
|
+
|
|
544
|
+
def test_transform_each(self):
|
|
545
|
+
def transform_wrapper(vin):
|
|
546
|
+
return transform(vin.get("data"), vin.get("spec"), vin.get("store"))
|
|
547
|
+
runset(spec["transform"]["each"], transform_wrapper)
|
|
548
|
+
|
|
549
|
+
def test_transform_pack(self):
|
|
550
|
+
def transform_wrapper(vin):
|
|
551
|
+
return transform(vin.get("data"), vin.get("spec"), vin.get("store"))
|
|
552
|
+
runset(spec["transform"]["pack"], transform_wrapper)
|
|
553
|
+
|
|
554
|
+
def test_transform_ref(self):
|
|
555
|
+
def transform_wrapper(vin):
|
|
556
|
+
return transform(vin.get("data"), vin.get("spec"), vin.get("store"))
|
|
557
|
+
runset(spec["transform"]["ref"], transform_wrapper)
|
|
558
|
+
|
|
559
|
+
def test_transform_modify(self):
|
|
560
|
+
def modifier(val, key, parent, inj):
|
|
561
|
+
if key is not None and parent is not None and isinstance(val, str):
|
|
562
|
+
parent[key] = '@' + val
|
|
563
|
+
|
|
564
|
+
runset(spec["transform"]["modify"],
|
|
565
|
+
lambda vin: transform(vin.get("data"), vin.get("spec"), {"modify": modifier, "extra": vin.get("store")}))
|
|
566
|
+
|
|
567
|
+
def test_transform_extra(self):
|
|
568
|
+
def upper_func(state, val, current, ref, store):
|
|
569
|
+
path = state.path
|
|
570
|
+
this_key = path[-1] if path else None
|
|
571
|
+
return str(this_key).upper()
|
|
572
|
+
|
|
573
|
+
self.assertEqual(
|
|
574
|
+
transform(
|
|
575
|
+
{"a": 1},
|
|
576
|
+
{"x": "`a`", "b": "`$COPY`", "c": "`$UPPER`"},
|
|
577
|
+
{
|
|
578
|
+
"extra": {
|
|
579
|
+
"b": 2,
|
|
580
|
+
"$UPPER": upper_func
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
),
|
|
584
|
+
{"x": 1, "b": 2, "c": "C"}
|
|
585
|
+
)
|
|
586
|
+
|
|
587
|
+
def test_transform_format(self):
|
|
588
|
+
def transform_wrapper(vin):
|
|
589
|
+
return transform(vin.get("data"), vin.get("spec"))
|
|
590
|
+
runsetflags(spec["transform"]["format"], {"null": False}, transform_wrapper)
|
|
591
|
+
|
|
592
|
+
def test_transform_apply(self):
|
|
593
|
+
def transform_wrapper(vin):
|
|
594
|
+
return transform(vin.get("data"), vin.get("spec"))
|
|
595
|
+
runset(spec["transform"]["apply"], transform_wrapper)
|
|
596
|
+
|
|
597
|
+
def test_transform_edge_apply(self):
|
|
598
|
+
self.assertEqual(2, transform({}, ['`$APPLY`', lambda v: 1 + v, 1]))
|
|
599
|
+
|
|
600
|
+
def test_transform_funcval(self):
|
|
601
|
+
def f0():
|
|
602
|
+
return 99
|
|
603
|
+
|
|
604
|
+
self.assertEqual(transform({}, {"x": 1}), {"x": 1})
|
|
605
|
+
self.assertEqual(transform({}, {"x": f0}), {"x": f0})
|
|
606
|
+
self.assertEqual(transform({"a": 1}, {"x": "`a`"}), {"x": 1})
|
|
607
|
+
self.assertEqual(transform({"f0": f0}, {"x": "`f0`"}), {"x": f0})
|
|
608
|
+
|
|
609
|
+
# -------------------------------------------------
|
|
610
|
+
# validate tests
|
|
611
|
+
# -------------------------------------------------
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
def test_validate_basic(self):
|
|
616
|
+
def validate_wrapper(vin):
|
|
617
|
+
return validate(vin.get("data"), vin.get("spec"))
|
|
618
|
+
runsetflags(spec["validate"]["basic"], {"null": False}, validate_wrapper)
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
def test_validate_child(self):
|
|
622
|
+
def validate_wrapper(vin):
|
|
623
|
+
return validate(vin.get("data"), vin.get("spec"))
|
|
624
|
+
runset(spec["validate"]["child"], validate_wrapper)
|
|
625
|
+
|
|
626
|
+
def test_validate_one(self):
|
|
627
|
+
def validate_wrapper(vin):
|
|
628
|
+
return validate(vin.get("data"), vin.get("spec"))
|
|
629
|
+
runset(spec["validate"]["one"], validate_wrapper)
|
|
630
|
+
|
|
631
|
+
def test_validate_exact(self):
|
|
632
|
+
def validate_wrapper(vin):
|
|
633
|
+
return validate(vin.get("data"), vin.get("spec"))
|
|
634
|
+
runset(spec["validate"]["exact"], validate_wrapper)
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
def test_validate_invalid(self):
|
|
638
|
+
runsetflags(spec["validate"]["invalid"], {"null": False},
|
|
639
|
+
lambda vin: validate(vin.get("data"), vin.get("spec")))
|
|
640
|
+
|
|
641
|
+
def test_validate_special(self):
|
|
642
|
+
def validate_wrapper(vin):
|
|
643
|
+
return validate(vin.get("data"), vin.get("spec"), vin.get("inj"))
|
|
644
|
+
runset(spec["validate"]["special"], validate_wrapper)
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
def test_validate_custom(self):
|
|
648
|
+
errs = []
|
|
649
|
+
|
|
650
|
+
def integer_check(state, _val, current, _ref, _store):
|
|
651
|
+
key = state.key
|
|
652
|
+
out = getprop(current, key)
|
|
653
|
+
|
|
654
|
+
if not isinstance(out, int) and not (isinstance(out, float) and out.is_integer()):
|
|
655
|
+
state.errs.append(
|
|
656
|
+
f"Not an integer at {'.'.join(state.path[1:])}: {out}"
|
|
657
|
+
)
|
|
658
|
+
return None
|
|
659
|
+
|
|
660
|
+
return out
|
|
661
|
+
|
|
662
|
+
extra = {
|
|
663
|
+
"$INTEGER": integer_check
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
shape = {"a": "`$INTEGER`"}
|
|
667
|
+
|
|
668
|
+
# Test with valid integer
|
|
669
|
+
out = validate({"a": 1}, shape, {"extra": extra, "errs": errs})
|
|
670
|
+
self.assertEqual(out, {"a": 1})
|
|
671
|
+
self.assertEqual(len(errs), 0)
|
|
672
|
+
|
|
673
|
+
# Test with invalid value
|
|
674
|
+
out = validate({"a": "A"}, shape, {"extra": extra, "errs": errs})
|
|
675
|
+
self.assertEqual(out, {"a": "A"})
|
|
676
|
+
self.assertEqual(errs, ["Not an integer at a: A"])
|
|
677
|
+
|
|
678
|
+
def test_validate_edge(self):
|
|
679
|
+
errs = []
|
|
680
|
+
validate({"x": 1}, {"x": '`$INSTANCE`'}, {"errs": errs})
|
|
681
|
+
self.assertEqual(errs[0], 'Expected field x to be instance, but found integer: 1.')
|
|
682
|
+
|
|
683
|
+
errs = []
|
|
684
|
+
validate({"x": {}}, {"x": '`$INSTANCE`'}, {"errs": errs})
|
|
685
|
+
self.assertEqual(errs[0], 'Expected field x to be instance, but found map: {}.')
|
|
686
|
+
|
|
687
|
+
errs = []
|
|
688
|
+
validate({"x": []}, {"x": '`$INSTANCE`'}, {"errs": errs})
|
|
689
|
+
self.assertEqual(errs[0], 'Expected field x to be instance, but found list: [].')
|
|
690
|
+
|
|
691
|
+
# -------------------------------------------------
|
|
692
|
+
# select tests
|
|
693
|
+
# -------------------------------------------------
|
|
694
|
+
|
|
695
|
+
def test_select_basic(self):
|
|
696
|
+
def select_wrapper(vin):
|
|
697
|
+
return select(vin.get("obj"), vin.get("query"))
|
|
698
|
+
runset(selectSpec["basic"], select_wrapper)
|
|
699
|
+
|
|
700
|
+
def test_select_operators(self):
|
|
701
|
+
def select_wrapper(vin):
|
|
702
|
+
return select(vin.get("obj"), vin.get("query"))
|
|
703
|
+
runset(selectSpec["operators"], select_wrapper)
|
|
704
|
+
|
|
705
|
+
def test_select_edge(self):
|
|
706
|
+
def select_wrapper(vin):
|
|
707
|
+
return select(vin.get("obj"), vin.get("query"))
|
|
708
|
+
runset(selectSpec["edge"], select_wrapper)
|
|
709
|
+
|
|
710
|
+
def test_select_alts(self):
|
|
711
|
+
def select_wrapper(vin):
|
|
712
|
+
return select(vin.get("obj"), vin.get("query"))
|
|
713
|
+
runset(selectSpec["alts"], select_wrapper)
|
|
714
|
+
|
|
715
|
+
# -------------------------------------------------
|
|
716
|
+
# JSON Builder tests
|
|
717
|
+
# -------------------------------------------------
|
|
718
|
+
|
|
719
|
+
def test_json_builder(self):
|
|
720
|
+
self.assertEqual(jsonify(jo('a', 1)), '{\n "a": 1\n}')
|
|
721
|
+
|
|
722
|
+
self.assertEqual(jsonify(ja('b', 2)), '[\n "b",\n 2\n]')
|
|
723
|
+
|
|
724
|
+
self.assertEqual(jsonify(jo(
|
|
725
|
+
'c', 'C',
|
|
726
|
+
'd', jo('x', True),
|
|
727
|
+
'e', ja(None, False)
|
|
728
|
+
)), '{\n "c": "C",\n "d": {\n "x": true\n },\n "e": [\n null,\n false\n ]\n}')
|
|
729
|
+
|
|
730
|
+
self.assertEqual(jsonify(ja(
|
|
731
|
+
3.3, jo(
|
|
732
|
+
'f', True,
|
|
733
|
+
'g', False,
|
|
734
|
+
'h', None,
|
|
735
|
+
'i', ja('y', 0),
|
|
736
|
+
'j', jo('z', -1),
|
|
737
|
+
'k')
|
|
738
|
+
)), '[\n 3.3,\n {\n "f": true,\n "g": false,\n "h": null,\n "i": [\n "y",\n 0\n ],\n "j": {\n "z": -1\n },\n "k": null\n }\n]')
|
|
739
|
+
|
|
740
|
+
self.assertEqual(jsonify(jo(
|
|
741
|
+
True, 1,
|
|
742
|
+
False, 2,
|
|
743
|
+
None, 3,
|
|
744
|
+
['a'], 4,
|
|
745
|
+
{'b': 0}, 5
|
|
746
|
+
)), '{\n "true": 1,\n "false": 2,\n "null": 3,\n "[a]": 4,\n "{b:0}": 5\n}')
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
# If you want to run this file directly, add:
|
|
750
|
+
if __name__ == "__main__":
|
|
751
|
+
unittest.main()
|