def test_static_templates_treatment_linearity(self):
        # With 2500 templates for starters
        nMod, nFilePerMod, nTemplatePerFile = 50, 5, 10
        self._sick_script(nMod, nFilePerMod, nTemplatePerFile)

        before = datetime.now()
        contents = HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        after = datetime.now()
        delta2500 = after - before
        _logger.runbot('Static Templates Inheritance: 2500 templates treated in %s seconds' % delta2500.total_seconds())

        whole_tree = etree.fromstring(contents)
        self.assertEqual(len(whole_tree), nMod * nFilePerMod * nTemplatePerFile)

        # With 25000 templates next
        nMod, nFilePerMod, nTemplatePerFile = 50, 5, 100
        self._sick_script(nMod, nFilePerMod, nTemplatePerFile)

        before = datetime.now()
        HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        after = datetime.now()
        delta25000 = after - before

        time_ratio = delta25000.total_seconds() / delta2500.total_seconds()
        _logger.runbot('Static Templates Inheritance: 25000 templates treated in %s seconds' % delta25000.total_seconds())
        _logger.runbot('Static Templates Inheritance: Computed linearity ratio: %s' % time_ratio)
        self.assertLessEqual(time_ratio, 12)
    def test_static_misordered_modules(self):
        self.modules.reverse()
        with self.assertRaises(ValueError) as ve:
            HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)

        self.assertEqual(
            str(ve.exception),
            'Module module_1 not loaded or inexistent, or templates of addon being loaded (module_2) are misordered'
        )
Ejemplo n.º 3
0
    def test_performance_25000(self):
        nMod, nFilePerMod, nTemplatePerFile = 50, 5, 100
        self._sick_script(nMod, nFilePerMod, nTemplatePerFile)

        before = datetime.now()
        HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        after = datetime.now()

        self.assertLessEqual(after - before, timedelta(milliseconds=1000))
Ejemplo n.º 4
0
    def test_static_inheritance_01(self):
        contents = HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <form t-name="template_1_1" random-attr="gloria">
                    <div>At first I was afraid</div>
                    <div>Kept thinking I could never live without you by my side</div>
                </form>
                <t t-name="template_1_2">
                    <div>And I grew strong</div>
                    <div>And I learned how to get along</div>
                </t>
                <form t-name="template_2_1" random-attr="gloria">
                    <div>At first I was afraid</div>
                    <div>I was petrified</div>
                    <div>But then I spent so many nights thinking how you did me wrong</div>
                    <div>Kept thinking I could never live without you by my side</div>
                </form>
                <div t-name="template_2_2">
                    <div>And I learned how to get along</div>
                </div>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
    def test_static_inheritance_02(self):
        self.template_files = {
            'module_1_file_1': b'''
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1" random-attr="gloria">
                        <div>At first I was afraid</div>
                        <div>Kept thinking I could never live without you by my side</div>
                    </form>
                    <form t-name="template_1_2" t-inherit="template_1_1" added="true">
                        <xpath expr="//div[1]" position="after">
                            <div>I was petrified</div>
                        </xpath>
                    </form>
                </templates>
            '''
        }
        self.modules = [
            ('module_1_file_1', None, 'module_1'),
        ]
        contents = HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <form t-name="template_1_1" random-attr="gloria">
                    <div>At first I was afraid</div>
                    <div>Kept thinking I could never live without you by my side</div>
                </form>
                <form t-name="template_1_2" random-attr="gloria" added="true">
                    <div>At first I was afraid</div>
                    <div>I was petrified</div>
                    <div>Kept thinking I could never live without you by my side</div>
                </form>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 6
0
    def test_replace_in_debug_mode(self):
        """
        Replacing a template's meta definition in place doesn't keep the original attrs of the template
        """
        self.asset_paths = [
            ('module_1_file_1', 'module_1', 'bundle_1'),
        ]
        self.template_files = {
            'module_1_file_1':
            b"""
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1" random-attr="gloria">
                        <div>At first I was afraid</div>
                    </form>
                    <t t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="extension">
                        <xpath expr="." position="replace">
                            <div overriden-attr="overriden">And I grew strong</div>
                        </xpath>
                    </t>
                </templates>
                """,
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <div overriden-attr="overriden" t-name="template_1_1">
                    And I grew strong
                </div>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 7
0
    def test_static_templates_treatment_linearity(self):
        # With 2500 templates for starters
        nMod, nFilePerMod, nTemplatePerFile = 50, 5, 10
        self._sick_script(nMod, nFilePerMod, nTemplatePerFile)

        before = datetime.now()
        contents = HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        after = datetime.now()
        delta2500 = after - before
Ejemplo n.º 8
0
    def test_replace_root_node_tag_in_primary(self):
        """
<<<<<<< HEAD
        Root node is not targeted by //NODE_TAG in xpath
=======
        Root node IS targeted by //NODE_TAG in xpath
>>>>>>> f0a66d05e70e432d35dc68c9fb1e1cc6e51b40b8
        """
        self.maxDiff = None
        self.modules = [
            ('module_1_file_1', None, 'module_1'),
        ]
        self.template_files = {
            'module_1_file_1': b"""
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1" random-attr="gloria">
                        <div>At first I was afraid</div>
                        <form>Inner Form</form>
                    </form>
<<<<<<< HEAD
                    <t t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="primary">
                        <xpath expr="//form" position="replace">
                            <div>Form replacer</div>
                        </xpath>
                    </t>
=======
                    <form t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="primary">
                        <xpath expr="//form" position="replace">
                            <div>Form replacer</div>
                        </xpath>
                    </form>
>>>>>>> f0a66d05e70e432d35dc68c9fb1e1cc6e51b40b8
                </templates>
                """,
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <form t-name="template_1_1" random-attr="gloria">
                    <div>At first I was afraid</div>
                    <form>Inner Form</form>
                </form>
<<<<<<< HEAD
                <form t-name="template_1_2" random-attr="gloria" t-inherit="template_1_1">
                    <div>At first I was afraid</div>
                    <div>Form replacer</div>
                </form>
=======
                <div t-name="template_1_2">
                    Form replacer
                </div>
>>>>>>> f0a66d05e70e432d35dc68c9fb1e1cc6e51b40b8
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 9
0
    def test_sibling_extension(self):
        self.modules = [
            ('module_1_file_1', None, 'module_1'),
            ('module_2_file_1', None, 'module_2'),
            ('module_3_file_1', None, 'module_3'),
        ]
        self.template_files = {
            'module_1_file_1':
            b'''
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1">
                        <div>I am a man of constant sorrow</div>
                        <div>I've seen trouble all my days</div>
                    </form>
                </templates>
            ''',
            'module_2_file_1':
            b'''
                <templates id="template" xml:space="preserve">
                    <form t-name="template_2_1" t-inherit="module_1.template_1_1" t-inherit-mode="extension">
                        <xpath expr="//div[1]" position="after">
                            <div>In constant sorrow all through his days</div>
                        </xpath>
                    </form>
                </templates>
            ''',
            'module_3_file_1':
            b'''
                <templates id="template" xml:space="preserve">
                    <form t-name="template_3_1" t-inherit="module_1.template_1_1" t-inherit-mode="extension">
                        <xpath expr="//div[2]" position="after">
                            <div>Oh Brother !</div>
                        </xpath>
                    </form>
                </templates>
            '''
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <form t-name="template_1_1">
                    <div>I am a man of constant sorrow</div>
                    <!-- Modified by template_2_1 from module_2 -->
                    <div>In constant sorrow all through his days</div>
                    <!-- Modified by template_3_1 from module_3 -->
                    <div>Oh Brother !</div>
                    <div>I've seen trouble all my days</div>
                </form>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
    def test_static_misordered_templates(self):
        self.template_files['module_2_file_1'] = b"""
            <templates id="template" xml:space="preserve">
                <form t-name="template_2_1" t-inherit="module_2.template_2_2" t-inherit-mode="primary">
                    <xpath expr="//div[1]" position="after">
                        <div>I was petrified</div>
                    </xpath>
                </form>
                <div t-name="template_2_2">
                    <div>And I learned how to get along</div>
                </div>
            </templates>
        """
        with self.assertRaises(ValueError) as ve:
            HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)

        self.assertEqual(
            str(ve.exception),
            'No template found to inherit from. Module module_2 and template name template_2_2'
        )
Ejemplo n.º 11
0
    def test_performance_2500(self):
        nMod, nFilePerMod, nTemplatePerFile = 50, 5, 10
        self._sick_script(nMod, nFilePerMod, nTemplatePerFile)

        before = datetime.now()
        contents = HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        after = datetime.now()
        self.assertLessEqual(after - before, timedelta(milliseconds=130))

        whole_tree = etree.fromstring(contents)
        self.assertEqual(len(whole_tree),
                         nMod * nFilePerMod * nTemplatePerFile)
Ejemplo n.º 12
0
    def test_replace_in_debug_mode3(self):
        """Text outside of a div which will replace a whole template
        becomes outside of the template
        This doesn't mean anything in terms of the business of template inheritance
        But it is in the XPATH specs"""
        self.modules = [
            ('module_1_file_1', None, 'module_1'),
        ]
        self.template_files = {
            'module_1_file_1': b"""
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1" random-attr="gloria">
                        <div>At first I was afraid</div>
                    </form>
                    <t t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="extension">
                        <xpath expr="." position="replace">
                            <div>
                                And I grew strong
                                <p>And I learned how to get along</p>
                            </div>
                            And so you're back
                        </xpath>
                    </t>
                </templates>
                """,
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
<<<<<<< HEAD
                <form>
                    <!-- Modified by template_1_2 from module_1 -->
                    And I grew strong
                    <p>And I learned how to get along</p>
                </form>
=======
                <div t-name="template_1_1">
                    <!-- Modified by template_1_2 from module_1 -->
                    And I grew strong
                    <p>And I learned how to get along</p>
                </div>
>>>>>>> f0a66d05e70e432d35dc68c9fb1e1cc6e51b40b8
                And so you're back
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 13
0
    def test_inherit_primary_replace_debug(self):
        """
        The inheriting template has got both its own defining attrs
        and new ones if one is to replace its defining root node
        """
        self.modules = [
            ('module_1_file_1', None, 'module_1'),
        ]
        self.template_files = {
            'module_1_file_1': b"""
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1" random-attr="gloria">
                        <div>At first I was afraid</div>
                    </form>
                    <t t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="primary">
                        <xpath expr="." position="replace">
                            <div overriden-attr="overriden">
                                And I grew strong
                                <p>And I learned how to get along</p>
                            </div>
                        </xpath>
                    </t>
                </templates>
                """,
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <form t-name="template_1_1" random-attr="gloria">
                    <div>At first I was afraid</div>
                 </form>
<<<<<<< HEAD
                 <form overriden-attr="overriden" t-name="template_1_2" t-inherit="template_1_1">
                    And I grew strong
                    <p>And I learned how to get along</p>
                 </form>
=======
                 <div overriden-attr="overriden" t-name="template_1_2">
                    And I grew strong
                    <p>And I learned how to get along</p>
                 </div>
>>>>>>> f0a66d05e70e432d35dc68c9fb1e1cc6e51b40b8
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 14
0
    def test_static_inherit_extended_template(self):
        self.modules = [
            ('module_1_file_1', None, 'module_1'),
        ]
        self.template_files = {
            'module_1_file_1':
            b'''
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1">
                        <div>At first I was afraid</div>
                        <div>Kept thinking I could never live without you by my side</div>
                    </form>
                    <form t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="extension">
                        <xpath expr="//div[1]" position="after">
                            <div>I was petrified</div>
                        </xpath>
                    </form>
                    <form t-name="template_1_3" t-inherit="template_1_1" t-inherit-mode="primary">
                        <xpath expr="//div[3]" position="after">
                            <div>But then I spent so many nights thinking how you did me wrong</div>
                        </xpath>
                    </form>
                </templates>
            ''',
        }
        contents = HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <form t-name="template_1_1">
                    <div>At first I was afraid</div>
                    <!-- Modified by template_1_2 from module_1 -->
                    <div>I was petrified</div>
                    <div>Kept thinking I could never live without you by my side</div>
                </form>
                <form t-name="template_1_3">
                    <div>At first I was afraid</div>
                    <div>I was petrified</div>
                    <div>Kept thinking I could never live without you by my side</div>
                    <div>But then I spent so many nights thinking how you did me wrong</div>
                </form>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 15
0
    def test_static_inheritance_in_same_module(self):
        self.asset_paths = [
            ('module_1_file_1', 'module_1', 'bundle_1'),
            ('module_1_file_2', 'module_1', 'bundle_1'),
        ]

        self.template_files = {
            'module_1_file_1':
            b'''
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1">
                        <div>At first I was afraid</div>
                        <div>Kept thinking I could never live without you by my side</div>
                    </form>
                </templates>
            ''',
            'module_1_file_2':
            b'''
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="primary">
                        <xpath expr="//div[1]" position="after">
                            <div>I was petrified</div>
                        </xpath>
                    </form>
                </templates>
            '''
        }
        contents = HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <form t-name="template_1_1">
                    <div>At first I was afraid</div>
                    <div>Kept thinking I could never live without you by my side</div>
                </form>
                <form t-name="template_1_2">
                    <div>At first I was afraid</div>
                    <div>I was petrified</div>
                    <div>Kept thinking I could never live without you by my side</div>
                </form>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 16
0
    def test_replace_in_nodebug_mode1(self):
        """Comments already in the arch are ignored"""
        self.modules = [
            ('module_1_file_1', None, 'module_1'),
        ]
        self.template_files = {
            'module_1_file_1': b"""
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1" random-attr="gloria">
                        <div>At first I was afraid</div>
                    </form>
                    <t t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="extension">
                        <xpath expr="." position="replace">
                            <div>
                                <!-- Random Comment -->
                                And I grew strong
                                <p>And I learned how to get along</p>
                                And so you're back
                            </div>
                        </xpath>
                    </t>
                </templates>
                """,
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=False)
        expected = b"""
            <templates>
<<<<<<< HEAD
                <form>
                    And I grew strong
                    <p>And I learned how to get along</p>
                    And so you're back
                </form>
=======
                <div t-name="template_1_1">
                    And I grew strong
                    <p>And I learned how to get along</p>
                    And so you're back
                </div>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 17
0
    def test_replace_in_debug_mode2(self):
        self.modules = [
            ('module_1_file_1', None, 'module_1'),
        ]
        self.template_files = {
            'module_1_file_1': b"""
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1" random-attr="gloria">
                        <div>At first I was afraid</div>
                    </form>
                    <t t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="extension">
                        <xpath expr="." position="replace">
                            <div>
                                And I grew strong
                                <p>And I learned how to get along</p>
                                And so you're back
                            </div>
                        </xpath>
                    </t>
                </templates>
                """,
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
<<<<<<< HEAD
                <form>
                    <!-- Modified by template_1_2 from module_1 -->And I grew strong
                    <p>And I learned how to get along</p>
                    And so you're back
                </form>
=======
                <div t-name="template_1_1">
                    <!-- Modified by template_1_2 from module_1 -->
                    And I grew strong
                    <p>And I learned how to get along</p>
                    And so you're back
                </div>
>>>>>>> f0a66d05e70e432d35dc68c9fb1e1cc6e51b40b8
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 18
0
    def test_inherit_from_dotted_tname_3(self):
        self.asset_paths = [
            ('module_1_file_1', 'module_1', 'bundle_1'),
            ('module_2_file_1', 'module_2', 'bundle_1'),
        ]
        self.template_files = {
            'module_1_file_1':
            b"""
                <templates id="template" xml:space="preserve">
                    <form t-name="module_1.template_1_1.dot" random-attr="gloria">
                        <div>At first I was afraid</div>
                    </form>
                </templates>
                """,
            'module_2_file_1':
            b"""
                <templates id="template" xml:space="preserve">
                    <t t-name="template_2_1" t-inherit="module_1.template_1_1.dot" t-inherit-mode="primary">
                        <xpath expr="." position="replace">
                            <div overriden-attr="overriden">
                                And I grew strong
                                <p>And I learned how to get along</p>
                            </div>
                        </xpath>
                    </t>
                </templates>
            """
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <form t-name="module_1.template_1_1.dot" random-attr="gloria">
                    <div>At first I was afraid</div>
                 </form>
                 <div overriden-attr="overriden" t-name="template_2_1">
                    And I grew strong
                    <p>And I learned how to get along</p>
                 </div>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 19
0
    def test_replace_root_node_tag_in_primary(self):
        """
        Root node IS targeted by //NODE_TAG in xpath
        """
        self.maxDiff = None
        self.asset_paths = [
            ('module_1_file_1', 'module_1', 'bundle_1'),
        ]
        self.template_files = {
            'module_1_file_1':
            b"""
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1" random-attr="gloria">
                        <div>At first I was afraid</div>
                        <form>Inner Form</form>
                    </form>
                    <form t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="primary">
                        <xpath expr="//form" position="replace">
                            <div>Form replacer</div>
                        </xpath>
                    </form>
                </templates>
                """,
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <form t-name="template_1_1" random-attr="gloria">
                    <div>At first I was afraid</div>
                    <form>Inner Form</form>
                </form>
                <div t-name="template_1_2">
                    Form replacer
                </div>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 20
0
    def test_replace_in_debug_mode2(self):
        self.asset_paths = [
            ('module_1_file_1', 'module_1', 'bundle_1'),
        ]
        self.template_files = {
            'module_1_file_1':
            b"""
                <templates id="template" xml:space="preserve">
                    <form t-name="template_1_1" random-attr="gloria">
                        <div>At first I was afraid</div>
                    </form>
                    <t t-name="template_1_2" t-inherit="template_1_1" t-inherit-mode="extension">
                        <xpath expr="." position="replace">
                            <div>
                                And I grew strong
                                <p>And I learned how to get along</p>
                                And so you're back
                            </div>
                        </xpath>
                    </t>
                </templates>
                """,
        }

        contents = HomeStaticTemplateHelpers.get_qweb_templates(
            addons=self._get_module_names(), debug=True)
        expected = b"""
            <templates>
                <div t-name="template_1_1">
                    And I grew strong
                    <p>And I learned how to get along</p>
                    And so you're back
                </div>
            </templates>
        """

        self.assertXMLEqual(contents, expected)
Ejemplo n.º 21
0
        contents = HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        after = datetime.now()
        delta2500 = after - before
<<<<<<< HEAD
        _logger.log(25, 'Static Templates Inheritance: 2500 templates treated in %s seconds' % delta2500.total_seconds())
=======
        _logger.runbot('Static Templates Inheritance: 2500 templates treated in %s seconds' % delta2500.total_seconds())
>>>>>>> f0a66d05e70e432d35dc68c9fb1e1cc6e51b40b8

        whole_tree = etree.fromstring(contents)
        self.assertEqual(len(whole_tree), nMod * nFilePerMod * nTemplatePerFile)

        # With 25000 templates next
        nMod, nFilePerMod, nTemplatePerFile = 50, 5, 100
        self._sick_script(nMod, nFilePerMod, nTemplatePerFile)

        before = datetime.now()
        HomeStaticTemplateHelpers.get_qweb_templates(addons=self._get_module_names(), debug=True)
        after = datetime.now()
        delta25000 = after - before

        time_ratio = delta25000.total_seconds() / delta2500.total_seconds()
<<<<<<< HEAD
        _logger.log(25, 'Static Templates Inheritance: 25000 templates treated in %s seconds' % delta25000.total_seconds())
        _logger.log(25, 'Static Templates Inheritance: Computed linearity ratio: %s' % time_ratio)
=======
        _logger.runbot('Static Templates Inheritance: 25000 templates treated in %s seconds' % delta25000.total_seconds())
        _logger.runbot('Static Templates Inheritance: Computed linearity ratio: %s' % time_ratio)
>>>>>>> f0a66d05e70e432d35dc68c9fb1e1cc6e51b40b8
        self.assertLessEqual(time_ratio, 10)