示例#1
0
    def test_index_from_location_bad_string(self):
        """ should return default value if bad string is supplied """

        support.create_project(self, 'ray')
        project = cauldron.project.get_internal_project()

        result = step_actions.index_from_location(None, project, '12s', 42)
        self.assertEqual(result, 42)
示例#2
0
    def test_index_from_location_bad_string(self):
        """ should return default value if bad string is supplied """

        support.create_project(self, 'ray')
        project = cauldron.project.get_internal_project()

        result = step_actions.index_from_location(None, project, '12s', 42)
        self.assertEqual(result, 42)
示例#3
0
    def test_index_from_location_step_name(self):
        """ should return index from step name if supplied """

        support.create_project(self, 'bradbury')
        support.add_step(self)
        project = cauldron.project.get_internal_project()
        step = project.steps[0]

        result = step_actions.index_from_location(None, project, step.filename)
        self.assertEqual(result, 1)
示例#4
0
    def test_index_from_location_step_name(self):
        """ should return index from step name if supplied """

        support.create_project(self, 'bradbury')
        support.add_step(self)
        project = cauldron.project.get_internal_project()
        step = project.steps[0]

        result = step_actions.index_from_location(None, project, step.filename)
        self.assertEqual(result, 1)
示例#5
0
    def test_index_from_location_default_final(self):
        """ Should return default if unable to parse location """

        result = step_actions.index_from_location(None, None, self, 42)
        self.assertEqual(result, 42)
示例#6
0
    def test_index_from_location_float(self):
        """ Should convert float index to integer """

        result = step_actions.index_from_location(None, None, 12.2)
        self.assertEqual(result, 12)
        self.assertIsInstance(result, int)
示例#7
0
    def test_index_from_location_default_final(self):
        """ Should return default if unable to parse location """

        result = step_actions.index_from_location(None, None, self, 42)
        self.assertEqual(result, 42)
示例#8
0
    def test_index_from_location_float(self):
        """ Should convert float index to integer """

        result = step_actions.index_from_location(None, None, 12.2)
        self.assertEqual(result, 12)
        self.assertIsInstance(result, int)