Ejemplo n.º 1
0
    def run(self, edit):

        r = sublime.Region(0, self.view.size())
        text = self.view.substr(r)

        cl = changelog_utils.parse(text)
    
        self.view.replace(edit, sublime.Region(0, self.view.size()), str(cl))
    def test_parse(self):

        with open('/Users/Marcus/Library/Application Support/Sublime Text 3/Packages/Changelog/tests/files/changelog.md', 'r') as f:
            text = f.read()

        expected = text
        actual = changelog_utils.parse(text)

        self.assertEqual(str(actual), expected)
Ejemplo n.º 3
0
    def run(self, edit):

        r = sublime.Region(0, self.view.size())
        text = self.view.substr(r)

        cl = changelog_utils.parse(text)
        cl.version(change=changelog.Change(), change_type='patch')
    
        self.view.replace(edit, sublime.Region(0, self.view.size()), str(cl))
    def test_parse_sections_notAllStr(self):

        with self.assertRaises(AssertionError, msg='sections can only contain strs'):
            changelog_utils.parse(text='', sections=['Added', 123])
    def test_parse_sections_empty(self):

        with self.assertRaises(AssertionError, msg='sections cannot be empty'):
            changelog_utils.parse(text='', sections=[])
    def test_parse_sections_notList(self):

        with self.assertRaises(AssertionError, msg='sections must be a list'):
            changelog_utils.parse(text='', sections=123)
    def test_parse_sections_none(self):

        with self.assertRaises(AssertionError, msg='sections cannot be None'):
            changelog_utils.parse(text='', sections=None)
    def test_parse_text_notStr(self):

        with self.assertRaises(AssertionError, msg='text must be a str'):
            changelog_utils.parse(text=123)
    def test_parse_text_none(self):

        with self.assertRaises(AssertionError, msg='text cannot be None'):
            changelog_utils.parse(text=None)