コード例 #1
0
    def test_cleared_opt_values(self):
        self.assertEqual(
            combine_opts(dict(foo=combine_lists), {'foo': ['bar']},
                         {'foo': ClearedValue(['baz'])}),
            # ClearedValue(['baz']) overrides bar
            {'foo': ['baz']})

        self.assertEqual(
            combine_opts(dict(foo=combine_lists), {'foo': ['bar']},
                         {'foo': ClearedValue(None)}),
            # not None!
            {'foo': []})
コード例 #2
0
ファイル: test_conf.py プロジェクト: kartheek6/mrjob
    def test_cleared_opt_values(self):
        self.assertEqual(
            combine_opts(dict(foo=combine_lists), {"foo": ["bar"]}, {"foo": ClearedValue(["baz"])}),
            # ClearedValue(['baz']) overrides bar
            {"foo": ["baz"]},
        )

        self.assertEqual(
            combine_opts(dict(foo=combine_lists), {"foo": ["bar"]}, {"foo": ClearedValue(None)}),
            # not None!
            {"foo": []},
        )
コード例 #3
0
ファイル: test_conf.py プロジェクト: Affirm/mrjob
    def test_cleared_opt_values(self):
        self.assertEqual(
            combine_opts(dict(foo=combine_lists),
                         {'foo': ['bar']},
                         {'foo': ClearedValue(['baz'])}),
            # ClearedValue(['baz']) overrides bar
            {'foo': ['baz']})

        self.assertEqual(
            combine_opts(dict(foo=combine_lists),
                         {'foo': ['bar']},
                         {'foo': ClearedValue(None)}),
            # not None!
            {'foo': []})
コード例 #4
0
ファイル: runner.py プロジェクト: Jyrsa/mrjob
    def combine_opts(cls, *opts_list):
        """Combine options from several sources (e.g. defaults, mrjob.conf,
        command line). Options later in the list take precedence.

        You don't need to re-implement this in a subclass
        """
        return combine_opts(cls._opts_combiners(), *opts_list)
コード例 #5
0
    def combine_opts(cls, *opts_list):
        """Combine options from several sources (e.g. defaults, mrjob.conf,
        command line). Options later in the list take precedence.

        You don't need to re-implement this in a subclass
        """
        return combine_opts(cls._opts_combiners(), *opts_list)
コード例 #6
0
    def _combine_opts(self, opt_list):
        """Combine several opt dictionaries into one. *opt_list*
        is a list of dictionaries containing validated options

        Override this if you need to base options off the values of
        other options, but don't need to issue warnings etc.
        about the options' source.
        """
        return combine_opts(self._opt_combiners(), *opt_list)
コード例 #7
0
ファイル: runner.py プロジェクト: okomestudio/mrjob
    def _combine_opts(self, opt_list):
        """Combine several opt dictionaries into one. *opt_list*
        is a list of dictionaries containing validated options

        Override this if you need to base options off the values of
        other options, but don't need to issue warnings etc.
        about the options' source.
        """
        return combine_opts(self._opt_combiners(), *opt_list)
コード例 #8
0
ファイル: test_conf.py プロジェクト: Affirm/mrjob
 def test_combine_opts(self):
     self.assertEqual(
         combine_opts(dict(foo=combine_lists),
                      {'foo': ['bar'], 'baz': ['qux']},
                      {'foo': ['baz'], 'baz': ['quux'], 'bar': 'garply'},
                      None,
                      {}),
         # "baz" doesn't use the list combiner, so ['qux'] is overwritten
         {'foo': ['bar', 'baz'], 'baz': ['quux'], 'bar': 'garply'})
コード例 #9
0
ファイル: test_conf.py プロジェクト: zhiaozhou/mrjob
 def test_combine_opts(self):
     self.assertEqual(
         combine_opts(dict(foo=combine_lists),
                      {'foo': ['bar'], 'baz': ['qux']},
                      {'foo': ['baz'], 'baz': ['quux'], 'bar': 'garply'},
                      None,
                      {}),
         # "baz" doesn't use the list combiner, so ['qux'] is overwritten
         {'foo': ['bar', 'baz'], 'baz': ['quux'], 'bar': 'garply'})
コード例 #10
0
ファイル: conf_test.py プロジェクト: gimlids/LTPM
 def test_combine_opts(self):
     combiners = {
         'foo': combine_lists,
     }
     assert_equal(
         combine_opts(combiners,
                      {'foo': ['bar'], 'baz': ['qux']},
                      {'foo': ['baz'], 'baz': ['quux'], 'bar': 'garply'},
                      None,
                      {}),
         # "baz" doesn't use the list combiner, so ['qux'] is overwritten
         {'foo': ['bar', 'baz'], 'baz': ['quux'], 'bar': 'garply'})
コード例 #11
0
ファイル: test_conf.py プロジェクト: kartheek6/mrjob
 def test_combine_opts(self):
     self.assertEqual(
         combine_opts(
             dict(foo=combine_lists),
             {"foo": ["bar"], "baz": ["qux"]},
             {"foo": ["baz"], "baz": ["quux"], "bar": "garply"},
             None,
             {},
         ),
         # "baz" doesn't use the list combiner, so ['qux'] is overwritten
         {"foo": ["bar", "baz"], "baz": ["quux"], "bar": "garply"},
     )
コード例 #12
0
 def test_combine_opts(self):
     combiners = {
         'foo': combine_lists,
     }
     assert_equal(
         combine_opts(combiners, {
             'foo': ['bar'],
             'baz': ['qux']
         }, {
             'foo': ['baz'],
             'baz': ['quux'],
             'bar': 'garply'
         }, None, {}),
         # "baz" doesn't use the list combiner, so ['qux'] is overwritten
         {
             'foo': ['bar', 'baz'],
             'baz': ['quux'],
             'bar': 'garply'
         })
コード例 #13
0
 def test_empty(self):
     self.assertEqual(combine_opts(combiners={}), {})
コード例 #14
0
ファイル: conf_test.py プロジェクト: gimlids/LTPM
 def test_empty(self):
     assert_equal(combine_opts(combiners={}), {})
コード例 #15
0
ファイル: test_conf.py プロジェクト: icio/mrjob
 def test_empty(self):
     self.assertEqual(combine_opts(combiners={}), {})
コード例 #16
0
 def test_empty(self):
     assert_equal(combine_opts(combiners={}), {})