Exemple #1
0
    def test_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z}")

        self.run_command('test', lib=None)
        replacements = self.test_cmd.lib.replacements
        self.assertEqual(replacements, [(re.compile(u'[xy]'), 'z')])
Exemple #2
0
    def test_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z}")

        ui._raw_main(["test"])
        replacements = self.test_cmd.lib.replacements
        self.assertEqual(replacements, [(re.compile(r"[xy]"), b"z")])
Exemple #3
0
    def test_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z}")

        ui._raw_main(['test'])
        replacements = self.test_cmd.lib.replacements
        self.assertEqual(replacements, [(re.compile(ur'[xy]'), b'z')])
Exemple #4
0
    def test_multiple_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z, foo: bar}")

        ui._raw_main(["test"])
        replacements = self.test_cmd.lib.replacements
        self.assertEqual(replacements, [(re.compile(ur"[xy]"), u"z"), (re.compile(ur"foo"), u"bar")])
Exemple #5
0
    def test_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z}")

        self.run_command('test', lib=None)
        replacements = self.test_cmd.lib.replacements
        self.assertEqual(replacements, [(re.compile(u'[xy]'), 'z')])
Exemple #6
0
    def test_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z}")

        ui._raw_main(['test'])
        replacements = self.test_cmd.lib.replacements
        self.assertEqual(replacements, [(re.compile(ur'[xy]'), u'z')])
Exemple #7
0
    def test_paths_section_respected(self):
        with self.write_config_file() as config:
            config.write('paths: {x: y}')

        ui._raw_main(['test'])
        key, template = self.test_cmd.lib.path_formats[0]
        self.assertEqual(key, 'x')
        self.assertEqual(template.original, 'y')
Exemple #8
0
    def test_paths_section_respected(self):
        with self.write_config_file() as config:
            config.write('paths: {x: y}')

        self.run_command('test', lib=None)
        key, template = self.test_cmd.lib.path_formats[0]
        self.assertEqual(key, 'x')
        self.assertEqual(template.original, 'y')
Exemple #9
0
    def test_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z}")

        self.run_command('test', lib=None)
        replacements = self.test_cmd.lib.replacements
        repls = [(p.pattern, s) for p, s in replacements]  # Compare patterns.
        self.assertEqual(repls, [(u'[xy]', 'z')])
Exemple #10
0
    def test_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z}")

        self.run_command('test', lib=None)
        replacements = self.test_cmd.lib.replacements
        repls = [(p.pattern, s) for p, s in replacements]  # Compare patterns.
        self.assertEqual(repls, [(u'[xy]', 'z')])
Exemple #11
0
    def test_paths_section_respected(self):
        with self.write_config_file() as config:
            config.write('paths: {x: y}')

        self.run_command('test', lib=None)
        key, template = self.test_cmd.lib.path_formats[0]
        self.assertEqual(key, 'x')
        self.assertEqual(template.original, 'y')
Exemple #12
0
    def test_paths_section_respected(self):
        with self.write_config_file() as config:
            config.write("paths: {x: y}")

        ui._raw_main(["test"])
        key, template = self.test_cmd.lib.path_formats[0]
        self.assertEqual(key, "x")
        self.assertEqual(template.original, "y")
Exemple #13
0
    def test_paths_section_respected(self):
        with self.write_config_file() as config:
            config.write('paths: {x: y}')

        ui._raw_main(['test'])
        key, template = self.test_cmd.lib.path_formats[0]
        self.assertEqual(key, 'x')
        self.assertEqual(template.original, 'y')
Exemple #14
0
 def test_multiple_replacements_parsed(self):
     with self.write_config_file() as config:
         config.write("replace: {'[xy]': z, foo: bar}")
     self.run_command('test', lib=None)
     replacements = self.test_cmd.lib.replacements
     self.assertEqual(replacements, [
         (re.compile(u'[xy]'), u'z'),
         (re.compile(u'foo'), u'bar'),
     ])
Exemple #15
0
 def test_multiple_replacements_parsed(self):
     with self.write_config_file() as config:
         config.write("replace: {'[xy]': z, foo: bar}")
     self.run_command('test', lib=None)
     replacements = self.test_cmd.lib.replacements
     self.assertEqual(replacements, [
         (re.compile(u'[xy]'), u'z'),
         (re.compile(u'foo'), u'bar'),
     ])
Exemple #16
0
 def test_multiple_replacements_parsed(self):
     with self.write_config_file() as config:
         config.write("replace: {'[xy]': z, foo: bar}")
     self.run_command('test', lib=None)
     replacements = self.test_cmd.lib.replacements
     repls = [(p.pattern, s) for p, s in replacements]
     self.assertEqual(repls, [
         (u'[xy]', u'z'),
         (u'foo', u'bar'),
     ])
Exemple #17
0
    def test_multiple_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z, foo: bar}")

        ui._raw_main(['test'])
        replacements = self.test_cmd.lib.replacements
        self.assertEqual(replacements, [
            (re.compile(ur'[xy]'), u'z'),
            (re.compile(ur'foo'), u'bar'),
        ])
Exemple #18
0
 def test_multiple_replacements_parsed(self):
     with self.write_config_file() as config:
         config.write("replace: {'[xy]': z, foo: bar}")
     self.run_command('test', lib=None)
     replacements = self.test_cmd.lib.replacements
     repls = [(p.pattern, s) for p, s in replacements]
     self.assertEqual(repls, [
         (u'[xy]', u'z'),
         (u'foo', u'bar'),
     ])
Exemple #19
0
    def test_multiple_replacements_parsed(self):
        with self.write_config_file() as config:
            config.write("replace: {'[xy]': z, foo: bar}")

        ui._raw_main(['test'])
        replacements = self.test_cmd.lib.replacements
        self.assertEqual(replacements, [
            (re.compile(u'[xy]'), u'z'),
            (re.compile(u'foo'), u'bar'),
        ])
Exemple #20
0
    def test_default_paths_preserved(self):
        default_formats = ui.get_path_formats()

        self._reset_config()
        with self.write_config_file() as config:
            config.write('paths: {x: y}')
        self.run_command('test', lib=None)
        key, template = self.test_cmd.lib.path_formats[0]
        self.assertEqual(key, 'x')
        self.assertEqual(template.original, 'y')
        self.assertEqual(self.test_cmd.lib.path_formats[1:], default_formats)
Exemple #21
0
    def test_default_paths_preserved(self):
        default_formats = ui.get_path_formats()

        self._reset_config()
        with self.write_config_file() as config:
            config.write('paths: {x: y}')
        self.run_command('test', lib=None)
        key, template = self.test_cmd.lib.path_formats[0]
        self.assertEqual(key, 'x')
        self.assertEqual(template.original, 'y')
        self.assertEqual(self.test_cmd.lib.path_formats[1:], default_formats)
Exemple #22
0
    def test_default_paths_preserved(self):
        default_formats = ui.get_path_formats()

        self._reset_config()
        with self.write_config_file() as config:
            config.write("paths: {x: y}")

        ui._raw_main(["test"])
        key, template = self.test_cmd.lib.path_formats[0]
        self.assertEqual(key, "x")
        self.assertEqual(template.original, "y")
        self.assertEqual(self.test_cmd.lib.path_formats[1:], default_formats)
Exemple #23
0
    def test_nonexistant_db(self):
        with self.write_config_file() as config:
            config.write('library: /xxx/yyy/not/a/real/path')

        with self.assertRaises(ui.UserError):
            ui._raw_main(['test'])
Exemple #24
0
    def test_nonexistant_db(self):
        with self.write_config_file() as config:
            config.write('library: /xxx/yyy/not/a/real/path')

        with self.assertRaises(ui.UserError):
            ui._raw_main(['test'])
Exemple #25
0
    def test_nonexistant_db(self):
        with self.write_config_file() as config:
            config.write('library: /xxx/yyy/not/a/real/path')

        with self.assertRaises(ui.UserError):
            self.run_command('test', lib=None)
Exemple #26
0
    def test_nonexistant_db(self):
        with self.write_config_file() as config:
            config.write('library: /xxx/yyy/not/a/real/path')

        with self.assertRaises(ui.UserError):
            self.run_command('test', lib=None)