1# Copyright 2017 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
15"""Test the use of flags when from __future__ import unicode_literals is on."""
16
17from absl import flags
18from absl.testing import absltest
19
20
21flags.DEFINE_string('seen_in_crittenden', 'alleged mountain lion',
22                    'This tests if unicode input to these functions works.')
23
24
25class FlagsUnicodeLiteralsTest(absltest.TestCase):
26
27  def testUnicodeFlagNameAndValueAreGood(self):
28    alleged_mountain_lion = flags.FLAGS.seen_in_crittenden
29    self.assertTrue(
30        isinstance(alleged_mountain_lion, type(u'')),
31        msg='expected flag value to be a {} not {}'.format(
32            type(u''), type(alleged_mountain_lion)))
33    self.assertEqual(alleged_mountain_lion, u'alleged mountain lion')
34
35
36if __name__ == '__main__':
37  absltest.main()
38