Debian Codegraph @

ml_collections/config_flags/examples/examples_test.py

raw symbols SCIP
1 # Copyright 2024 The ML Collections 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 """Tests for config_flags examples.
16
17 Ensures that from define_config_dict_basic, define_config_file_basic run
18 successfully.
19 """
20
21 from absl import flags
22 from absl.testing import absltest
23 from absl.testing import flagsaver
24 from ml_collections.config_flags.examples import define_config_dict_basic
25 from ml_collections.config_flags.examples import define_config_file_basic
26
27 FLAGS = flags.FLAGS
28
29
30 class ConfigDictExamplesTest(absltest.TestCase):
31
32 def test_define_config_dict_basic(self):
33 define_config_dict_basic.main([])
34
35 @flagsaver.flagsaver
36 def test_define_config_file_basic(self):
37 FLAGS.my_config = 'ml_collections/config_flags/examples/config.py'
38 define_config_file_basic.main([])
39
40 @flagsaver.flagsaver
41 def test_define_config_file_parameterised(self):
42 FLAGS.my_config = 'ml_collections/config_flags/examples/parameterised_config.py:linear'
43 define_config_file_basic.main([])
44
45
46 if __name__ == '__main__':
47 absltest.main()