1# Copyright 2020 The Abseil Authors. 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"""Python3-only Tests for absltest.""" 15 16from absl.testing import absltest 17 18 19class GetTestCaseNamesPEP3102Test(absltest.TestCase): 20 """This test verifies absltest.TestLoader.GetTestCasesNames PEP3102 support. 21 22 The test is Python3 only, as keyword only arguments are considered 23 syntax error in Python2. 24 25 The rest of getTestCaseNames functionality is covered 26 by absltest_test.TestLoaderTest. 27 """ 28 29 class Valid(absltest.TestCase): 30 31 def testKeywordOnly(self, *, arg): 32 pass 33 34 def setUp(self): 35 self.loader = absltest.TestLoader() 36 super(GetTestCaseNamesPEP3102Test, self).setUp() 37 38 def test_PEP3102_get_test_case_names(self): 39 self.assertCountEqual( 40 self.loader.getTestCaseNames(GetTestCaseNamesPEP3102Test.Valid), 41 ["testKeywordOnly"]) 42 43if __name__ == "__main__": 44 absltest.main() 45