test_encoding.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # Copyright 2021-2025 Avaiga Private Limited
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
  4. # the License. You may obtain a copy of the License at
  5. #
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. #
  8. # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
  9. # an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
  10. # specific language governing permissions and limitations under the License.
  11. import taipy.core.taipy as tp
  12. from taipy.common.config import Config
  13. def test_no_special_characters():
  14. scenario_config = Config.configure_scenario("scenario_1")
  15. scenario = tp.create_scenario(scenario_config, name="martin")
  16. assert scenario.name == "martin"
  17. scenarios = tp.get_scenarios()
  18. assert len(scenarios) == 1
  19. assert scenarios[0].name == "martin"
  20. def test_many_special_characters():
  21. scenario_config = Config.configure_scenario("scenario_1")
  22. special_characters = (
  23. "!#$%&'()*+,-./:;<=>?@[]^_`\\{"
  24. "|}~¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º"
  25. "»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ"
  26. "רÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñò"
  27. "óôõö÷øùúûüýþÿĀāĂ㥹ĆćĈĉĊċČčĎ"
  28. "ďĐđĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħĨĩĪ"
  29. "īĬĭĮįİIJijĴĵĶķĸĹĺĻļĽľĿŀŁłŃńŅņŇ"
  30. "ňʼnŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞşŠšŢţ"
  31. "ŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽžſ"
  32. )
  33. scenario = tp.create_scenario(scenario_config, name=special_characters)
  34. assert scenario.name == special_characters
  35. scenarios = tp.get_scenarios()
  36. assert len(scenarios) == 1
  37. assert scenarios[0].name == special_characters