1# Copyright 2023 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"" 16 17load("@rules_testing//lib:test_suite.bzl", "test_suite") 18load("//python/private:normalize_name.bzl", "normalize_name") # buildifier: disable=bzl-visibility 19 20_tests = [] 21 22def _test_name_normalization(env): 23 want = { 24 input: "friendly_bard" 25 for input in [ 26 "friendly-bard", 27 "Friendly-Bard", 28 "FRIENDLY-BARD", 29 "friendly.bard", 30 "friendly_bard", 31 "friendly--bard", 32 "FrIeNdLy-._.-bArD", 33 ] 34 } 35 36 actual = { 37 input: normalize_name(input) 38 for input in want.keys() 39 } 40 env.expect.that_dict(actual).contains_exactly(want) 41 42_tests.append(_test_name_normalization) 43 44def normalize_name_test_suite(name): 45 """Create the test suite. 46 47 Args: 48 name: the name of the test suite 49 """ 50 test_suite(name = name, basic_tests = _tests) 51