Пример #1
0
    def test_context_detection(self):
        """ Context detection determines the completion type to be sent back to
        the client
        """
        filename = os.path.join(BASE_DIR, 'templates/django_completeme/test_parser_load.html')

        inspector = TemplateInspector(filename, 12, 14)

        self.assertIsNotNone(inspector.completions(12, 14))
        self.assertIsNotNone(inspector.completions(16, 14))
        self.assertIsNotNone(inspector.completions(21, 7))
        self.assertIsNotNone(inspector.completions(25, 16))
        self.assertIsNotNone(inspector.completions(25, 16))
        self.assertIsNotNone(inspector.completions(29, 11))
        self.assertIsNotNone(inspector.completions(33, 16))
Пример #2
0
    def test_all_completion_types(self):

        filename = os.path.join(BASE_DIR, 'templates/django_completeme/test_parser_load.html')

        # point expexts {% load %} completes
        load_line, load_col = 10, 14
        inspector = TemplateInspector(filename, load_line, load_col)

        self.assertIsNotNone(inspector._staticfiles())
        self.assertIsNotNone(inspector._tags())
        self.assertIsNotNone(inspector._filters())
        self.assertIsNotNone(inspector._templates())
        self.assertIsNotNone(inspector._blocks())
        self.assertIsNotNone(inspector._urls())