コード例 #1
0
ファイル: tests.py プロジェクト: mcdonc/buildit
    def test_resolve_options_indirectloop(self):
        options = {
            "name1": "${./name2}",
            "name2": "${./name3}",
            "name3": "${./name1}this is name3",
            "name4": "this is name4",
            "another": "another",
        }
        from resolver import resolve_options
        from resolver import CyclicDependencyError

        try:
            resolve_options("foo", {"foo": options})
        except CyclicDependencyError, why:
            self.assertEqual(
                why[0], {("foo", "name2"): ["name1"], ("foo", "name3"): ["name2"], ("foo", "name1"): ["name3"]}
            )
コード例 #2
0
ファイル: tests.py プロジェクト: ChrisCarlsen/tortuga
    def test_resolve_options_indirectloop(self):
        options = {'name1':'${./name2}',
                   'name2':'${./name3}',
                   'name3':'${./name1}this is name3',
                   'name4':'this is name4',
                   'another':'another'}
        from resolver import resolve_options
        from resolver import CyclicDependencyError

        try:
            resolve_options('foo', {'foo':options})
        except CyclicDependencyError, why:
            self.assertEqual(why[0],
                 {
                ('foo', 'name2'): ['name1'],
                ('foo', 'name3'): ['name2'],
                ('foo', 'name1'): ['name3']
                })
コード例 #3
0
ファイル: tests.py プロジェクト: stormageAC/tortuga
    def test_resolve_options_indirectloop(self):
        options = {
            'name1': '${./name2}',
            'name2': '${./name3}',
            'name3': '${./name1}this is name3',
            'name4': 'this is name4',
            'another': 'another'
        }
        from resolver import resolve_options
        from resolver import CyclicDependencyError

        try:
            resolve_options('foo', {'foo': options})
        except CyclicDependencyError, why:
            self.assertEqual(
                why[0], {
                    ('foo', 'name2'): ['name1'],
                    ('foo', 'name3'): ['name2'],
                    ('foo', 'name1'): ['name3']
                })
コード例 #4
0
ファイル: tests.py プロジェクト: ChrisCarlsen/tortuga
    def test_resolve_options_directloop(self):
        options = {'name1':'${./name2}',
                   'name2':'${./name1}',
                   'name3':'this is name3',
                   'name4':'this is name4',
                   'another':'another'}
        from resolver import resolve_options
        from resolver import CyclicDependencyError

        try:
            resolve_options('foo', {'foo':options})
        except CyclicDependencyError, why:
            self.assertEqual(why[0],
                             {
                ('foo', 'name2'): ['name1'],
                ('foo', 'name1'): ['name2'],
                })
            self.assertEqual(str(why),
                  ("<CyclicDependencyError: In section 'foo', option 'name1' "
                   "depends on options ['name2']; In section 'foo', option "
                   "'name2' depends on options ['name1']>"))
コード例 #5
0
ファイル: tests.py プロジェクト: mcdonc/buildit
    def test_resolve_options_directloop(self):
        options = {
            "name1": "${./name2}",
            "name2": "${./name1}",
            "name3": "this is name3",
            "name4": "this is name4",
            "another": "another",
        }
        from resolver import resolve_options
        from resolver import CyclicDependencyError

        try:
            resolve_options("foo", {"foo": options})
        except CyclicDependencyError, why:
            self.assertEqual(why[0], {("foo", "name2"): ["name1"], ("foo", "name1"): ["name2"]})
            self.assertEqual(
                str(why),
                (
                    "<CyclicDependencyError: In section 'foo', option 'name1' "
                    "depends on options ['name2']; In section 'foo', option "
                    "'name2' depends on options ['name1']>"
                ),
            )
コード例 #6
0
ファイル: tests.py プロジェクト: stormageAC/tortuga
    def test_resolve_options_directloop(self):
        options = {
            'name1': '${./name2}',
            'name2': '${./name1}',
            'name3': 'this is name3',
            'name4': 'this is name4',
            'another': 'another'
        }
        from resolver import resolve_options
        from resolver import CyclicDependencyError

        try:
            resolve_options('foo', {'foo': options})
        except CyclicDependencyError, why:
            self.assertEqual(why[0], {
                ('foo', 'name2'): ['name1'],
                ('foo', 'name1'): ['name2'],
            })
            self.assertEqual(
                str(why),
                ("<CyclicDependencyError: In section 'foo', option 'name1' "
                 "depends on options ['name2']; In section 'foo', option "
                 "'name2' depends on options ['name1']>"))
コード例 #7
0
ファイル: tests.py プロジェクト: ChrisCarlsen/tortuga
 def test_resolve_options_localonly(self):
     options = {'name1':'hello ${./name2}',
                'name2':'${./name3} goodbye',
                'name3':'this is name3',
                'name4':'this is name4',
                'another':'another',
                'repeated':'${./another} ${./another} ${./name3}'}
     from resolver import resolve_options
     new = resolve_options('foo', {'foo':options})
     self.assertEqual(new, {'name1':'hello this is name3 goodbye',
                            'name2':'this is name3 goodbye',
                            'name3':'this is name3',
                            'name4':'this is name4',
                            'repeated':'another another this is name3',
                            'another':'another'})
コード例 #8
0
ファイル: tests.py プロジェクト: ChrisCarlsen/tortuga
 def test_resolve_options_defaults(self):
     options = {'name1':'hello ${./name2}',
                'name2':'${./name3} goodbye ${default1}',
                'name3':'this is name3 ${default2}',
                'name4':'this is name4',
                'another':'another'}
     from resolver import resolve_options
     new = resolve_options('foo', {'foo':options},
                           defaults={'default1':'singsong',
                                     'default2':'JAMMA'})
     self.assertEqual(new,
                      {'name1':'hello this is name3 JAMMA goodbye singsong',
                       'name2':'this is name3 JAMMA goodbye singsong',
                       'name3':'this is name3 JAMMA',
                       'name4':'this is name4',
                       'another':'another'})
コード例 #9
0
ファイル: tests.py プロジェクト: ChrisCarlsen/tortuga
 def test_resolve_options_missing_locals(self):
     options = {'name1':'hello ${./localmissing1}',
                'name2':'${./localmissing2} goodbye ${defaultmissing1}',
                'name3':'this is name3 ${defaultmissing2}',
                'name4':'this is name4',
                'another':'another'}
     from resolver import resolve_options
     from resolver import MissingDependencyError
     from resolver import LOCAL
     from resolver import DEFAULT
     try:
         new = resolve_options('foo', {'foo':options})
     except MissingDependencyError, why:
         self.assertEqual(why.section_name, 'foo')
         self.assertEqual(why.option_name, 'localmissing1')
         self.assertEqual(why.value, 'hello ${./localmissing1}')
         self.assertEqual(why.offender, 'name1')
コード例 #10
0
ファイル: tests.py プロジェクト: stormageAC/tortuga
 def test_resolve_options_missing_locals(self):
     options = {
         'name1': 'hello ${./localmissing1}',
         'name2': '${./localmissing2} goodbye ${defaultmissing1}',
         'name3': 'this is name3 ${defaultmissing2}',
         'name4': 'this is name4',
         'another': 'another'
     }
     from resolver import resolve_options
     from resolver import MissingDependencyError
     from resolver import LOCAL
     from resolver import DEFAULT
     try:
         new = resolve_options('foo', {'foo': options})
     except MissingDependencyError, why:
         self.assertEqual(why.section_name, 'foo')
         self.assertEqual(why.option_name, 'localmissing1')
         self.assertEqual(why.value, 'hello ${./localmissing1}')
         self.assertEqual(why.offender, 'name1')
コード例 #11
0
ファイル: tests.py プロジェクト: mcdonc/buildit
    def test_resolve_options_missing_locals(self):
        options = {
            "name1": "hello ${./localmissing1}",
            "name2": "${./localmissing2} goodbye ${defaultmissing1}",
            "name3": "this is name3 ${defaultmissing2}",
            "name4": "this is name4",
            "another": "another",
        }
        from resolver import resolve_options
        from resolver import MissingDependencyError
        from resolver import LOCAL
        from resolver import DEFAULT

        try:
            new = resolve_options("foo", {"foo": options})
        except MissingDependencyError, why:
            self.assertEqual(why.section_name, "foo")
            self.assertEqual(why.option_name, "localmissing1")
            self.assertEqual(why.value, "hello ${./localmissing1}")
            self.assertEqual(why.offender, "name1")
コード例 #12
0
ファイル: tests.py プロジェクト: stormageAC/tortuga
 def test_resolve_options_localonly(self):
     options = {
         'name1': 'hello ${./name2}',
         'name2': '${./name3} goodbye',
         'name3': 'this is name3',
         'name4': 'this is name4',
         'another': 'another',
         'repeated': '${./another} ${./another} ${./name3}'
     }
     from resolver import resolve_options
     new = resolve_options('foo', {'foo': options})
     self.assertEqual(
         new, {
             'name1': 'hello this is name3 goodbye',
             'name2': 'this is name3 goodbye',
             'name3': 'this is name3',
             'name4': 'this is name4',
             'repeated': 'another another this is name3',
             'another': 'another'
         })
コード例 #13
0
ファイル: tests.py プロジェクト: mcdonc/buildit
    def test_resolve_options_defaults(self):
        options = {
            "name1": "hello ${./name2}",
            "name2": "${./name3} goodbye ${default1}",
            "name3": "this is name3 ${default2}",
            "name4": "this is name4",
            "another": "another",
        }
        from resolver import resolve_options

        new = resolve_options("foo", {"foo": options}, defaults={"default1": "singsong", "default2": "JAMMA"})
        self.assertEqual(
            new,
            {
                "name1": "hello this is name3 JAMMA goodbye singsong",
                "name2": "this is name3 JAMMA goodbye singsong",
                "name3": "this is name3 JAMMA",
                "name4": "this is name4",
                "another": "another",
            },
        )
コード例 #14
0
ファイル: tests.py プロジェクト: stormageAC/tortuga
 def test_resolve_options_defaults(self):
     options = {
         'name1': 'hello ${./name2}',
         'name2': '${./name3} goodbye ${default1}',
         'name3': 'this is name3 ${default2}',
         'name4': 'this is name4',
         'another': 'another'
     }
     from resolver import resolve_options
     new = resolve_options('foo', {'foo': options},
                           defaults={
                               'default1': 'singsong',
                               'default2': 'JAMMA'
                           })
     self.assertEqual(
         new, {
             'name1': 'hello this is name3 JAMMA goodbye singsong',
             'name2': 'this is name3 JAMMA goodbye singsong',
             'name3': 'this is name3 JAMMA',
             'name4': 'this is name4',
             'another': 'another'
         })
コード例 #15
0
ファイル: tests.py プロジェクト: mcdonc/buildit
    def test_resolve_options_localonly(self):
        options = {
            "name1": "hello ${./name2}",
            "name2": "${./name3} goodbye",
            "name3": "this is name3",
            "name4": "this is name4",
            "another": "another",
            "repeated": "${./another} ${./another} ${./name3}",
        }
        from resolver import resolve_options

        new = resolve_options("foo", {"foo": options})
        self.assertEqual(
            new,
            {
                "name1": "hello this is name3 goodbye",
                "name2": "this is name3 goodbye",
                "name3": "this is name3",
                "name4": "this is name4",
                "repeated": "another another this is name3",
                "another": "another",
            },
        )