当前位置: 首页>>代码示例>>Python>>正文


Python Dive.do_dive方法代码示例

本文整理汇总了Python中dipplanner.dive.Dive.do_dive方法的典型用法代码示例。如果您正苦于以下问题:Python Dive.do_dive方法的具体用法?Python Dive.do_dive怎么用?Python Dive.do_dive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dipplanner.dive.Dive的用法示例。


在下文中一共展示了Dive.do_dive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestDiveAirDiveOutput2

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveAirDiveOutput2(TestDive):
    """Test segments output for air dive 2."""

    expected_result = [
        " DESCENT: at  20m for   1:00 [RT:  1:00], on Air,  SP:0.0, END:19m",
        "   CONST: at  20m for  29:00 [RT: 30:00], on Air,  SP:0.0, END:19m",
        "  ASCENT: at   9m for   1:06 [RT: 31:06], on Air,  SP:0.0, END:8m",
        "    DECO: at   9m for   0:01 [RT: 31:07], on Air,  SP:0.0, END:8m",
        "  ASCENT: at   6m for   1:00 [RT: 32:07], on Air,  SP:0.0, END:5m",
        "    DECO: at   6m for   0:01 [RT: 32:08], on Air,  SP:0.0, END:5m",
        "  ASCENT: at   3m for   1:00 [RT: 33:08], on Air,  SP:0.0, END:2m",
        "    DECO: at   3m for   0:50 [RT: 33:58], on Air,  SP:0.0, END:2m",
        "  ASCENT: at   0m for   1:00 [RT: 34:58], on Air,  SP:0.0, END:0m", ]

    def setUp(self):
        """Init of the tests."""
        super().setUp()
        diveseg2 = SegmentDive(20, 30 * 60, self.airtank, 0)
        self.profile1 = Dive([diveseg2], [self.airtank])
        self.profile1.do_dive()

    def test_segments(self):
        """Check all segments."""
        for idx in range(len(self.expected_result)):
            self.assertEqual(
                str(self.profile1.output_segments[idx]),
                self.expected_result[idx],
                'bad segment n°%s (%s)' % (
                    idx, self.profile1.output_segments[idx]))
开发者ID:ThomasChiroux,项目名称:dipplanner,代码行数:31,代码来源:dive_test.py

示例2: TestDiveAirDiveOutput1

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveAirDiveOutput1(TestDive):
    """Test segments output for air dive 1."""

    expected_result = [
        " DESCENT: at  30m for   1:30 [RT:  1:30], on Air,  SP:0.0, END:29m",
        "   CONST: at  30m for  28:30 [RT: 30:00], on Air,  SP:0.0, END:29m",
        "  ASCENT: at  15m for   1:30 [RT: 31:30], on Air,  SP:0.0, END:14m",
        "    DECO: at  15m for   0:01 [RT: 31:31], on Air,  SP:0.0, END:14m",
        "  ASCENT: at  12m for   1:00 [RT: 32:31], on Air,  SP:0.0, END:11m",
        "    DECO: at  12m for   0:20 [RT: 32:51], on Air,  SP:0.0, END:11m",
        "  ASCENT: at   9m for   1:00 [RT: 33:51], on Air,  SP:0.0, END:8m",
        "    DECO: at   9m for   2:39 [RT: 36:30], on Air,  SP:0.0, END:8m",
        "  ASCENT: at   6m for   1:00 [RT: 37:30], on Air,  SP:0.0, END:5m",
        "    DECO: at   6m for   4:59 [RT: 42:29], on Air,  SP:0.0, END:5m",
        "  ASCENT: at   3m for   1:00 [RT: 43:29], on Air,  SP:0.0, END:2m",
        "    DECO: at   3m for  12:42 [RT: 56:11], on Air,  SP:0.0, END:2m",
        "  ASCENT: at   0m for   1:00 [RT: 57:11], on Air,  SP:0.0, END:0m", ]

    def setUp(self):
        """Init of the tests."""
        super().setUp()
        diveseg1 = SegmentDive(30, 30 * 60, self.airtank, 0)
        self.profile1 = Dive([diveseg1], [self.airtank])
        self.profile1.do_dive()

    def test_segments(self):
        """Check all segments."""
        for idx in range(len(self.expected_result)):
            self.assertEqual(
                str(self.profile1.output_segments[idx]),
                self.expected_result[idx],
                'bad segment n°%s (%s)' % (
                    idx, self.profile1.output_segments[idx]))
开发者ID:ThomasChiroux,项目名称:dipplanner,代码行数:35,代码来源:dive_test.py

示例3: TestDiveTxDiveOutput1

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveTxDiveOutput1(TestDive):
    """Test segments output for tx dive 1."""

    expected_result = [
        " DESCENT: at  30m for   1:30 [RT:  1:30], on Trimix 21/30,  SP:0.0, END:19m",
        "   CONST: at  30m for  28:30 [RT: 30:00], on Trimix 21/30,  SP:0.0, END:19m",
        "  ASCENT: at  15m for   1:30 [RT: 31:30], on Trimix 21/30,  SP:0.0, END:8m",
        "    DECO: at  15m for   0:01 [RT: 31:31], on Trimix 21/30,  SP:0.0, END:8m",
        "  ASCENT: at  12m for   1:00 [RT: 32:31], on Trimix 21/30,  SP:0.0, END:6m",
        "    DECO: at  12m for   0:38 [RT: 33:09], on Trimix 21/30,  SP:0.0, END:6m",
        "  ASCENT: at   9m for   1:00 [RT: 34:09], on Trimix 21/30,  SP:0.0, END:4m",
        "    DECO: at   9m for   3:04 [RT: 37:13], on Trimix 21/30,  SP:0.0, END:4m",
        "  ASCENT: at   6m for   1:00 [RT: 38:13], on Trimix 21/30,  SP:0.0, END:1m",
        "    DECO: at   6m for   6:25 [RT: 44:38], on Trimix 21/30,  SP:0.0, END:1m",
        "  ASCENT: at   3m for   1:00 [RT: 45:38], on Trimix 21/30,  SP:0.0, END:0m",
        "    DECO: at   3m for  16:12 [RT: 61:50], on Trimix 21/30,  SP:0.0, END:0m",
        "  ASCENT: at   0m for   1:00 [RT: 62:50], on Trimix 21/30,  SP:0.0, END:0m", ]

    def setUp(self):
        """Init of the tests."""
        super().setUp()
        diveseg1 = SegmentDive(30, 30 * 60, self.txtank1, 0)
        self.profile1 = Dive([diveseg1], [self.txtank1])
        self.profile1.do_dive()

    def test_segments(self):
        """Check all segments."""
        for idx in range(len(self.expected_result)):
            self.assertEqual(
                str(self.profile1.output_segments[idx]),
                self.expected_result[idx],
                'bad segment n°%s (%s)' % (
                    idx, self.profile1.output_segments[idx]))
开发者ID:ThomasChiroux,项目名称:dipplanner,代码行数:35,代码来源:dive_test.py

示例4: TestDiveAirDiveRunTime1

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveAirDiveRunTime1(TestDive):

    def runTest(self):
        diveseg1 = SegmentDive(30, 30 * 60, self.airtank, 0)
        self.profile1 = Dive([diveseg1], [self.airtank])
        self.profile1.do_dive()
        self.assertEqual(seconds_to_mmss(self.profile1.run_time),
                         ' 48:24', 'bad dive runtime ? (%s)'
                         % seconds_to_mmss(self.profile1.run_time))
开发者ID:hordurk,项目名称:dipplanner,代码行数:11,代码来源:dive_test.py

示例5: TestDiveAirDiveRunTime2

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveAirDiveRunTime2(TestDive):

    def runTest(self):
        diveseg2 = SegmentDive(20, 30 * 60, self.airtank, 0)
        self.profile2 = Dive([diveseg2], [self.airtank])
        self.profile2.do_dive()
        self.assertEqual(seconds_to_mmss(self.profile2.run_time),
                         ' 32:04', 'bad dive runtime (%s)'
                         % seconds_to_mmss(self.profile2.run_time))
开发者ID:hordurk,项目名称:dipplanner,代码行数:11,代码来源:dive_test.py

示例6: TestDiveAirDiveRunTime3

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveAirDiveRunTime3(TestDive):

    def runTest(self):
        diveseg3 = SegmentDive(55, 30 * 60, self.airdouble, 0)
        self.profile3 = Dive([diveseg3], [self.airdouble])
        self.profile3.do_dive()
        self.assertEqual(seconds_to_mmss(self.profile3.run_time),
                         '131:05', 'bad dive runtime (%s)'
                         % seconds_to_mmss(self.profile3.run_time))
开发者ID:hordurk,项目名称:dipplanner,代码行数:11,代码来源:dive_test.py

示例7: TestDiveTxDiveRunTime1

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveTxDiveRunTime1(TestDive):

    def runTest(self):
        diveseg1 = SegmentDive(30, 30 * 60, self.txtank1, 0)
        self.profile1 = Dive([diveseg1], [self.txtank1])
        self.profile1.do_dive()
        self.assertEqual(seconds_to_mmss(self.profile1.run_time),
                         ' 55:03', 'bad dive runtime (%s)'
                         % seconds_to_mmss(self.profile1.run_time))
开发者ID:hordurk,项目名称:dipplanner,代码行数:11,代码来源:dive_test.py

示例8: TestDiveNotEnoughGas1

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveNotEnoughGas1(TestDive):

    def runTest(self):
        diveseg1 = SegmentDive(60, 30 * 60, self.air12l, 0)
        self.profile1 = Dive([diveseg1], [self.air12l])
        self.profile1.do_dive()
        self.assertEqual(self.profile1.tanks[0].check_rule(), False,
                         'Wrong tank status : it should fail the remaining '
                         'gas rule test (result:%s)'
                         % self.profile1.tanks[0].check_rule())
开发者ID:hordurk,项目名称:dipplanner,代码行数:12,代码来源:dive_test.py

示例9: TestRepetitiveDive1

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestRepetitiveDive1(TestDive):

    def setUp(self):
        TestDive.setUp(self)

        diveseg1 = SegmentDive(40, 20 * 60, self.airtank12, 0)
        self.profile0 = Dive([diveseg1], [self.airtank12])
        self.profile0.do_dive()

        diveseg2 = SegmentDive(40, 20 * 60, self.airtank, 0)
        self.profile1 = Dive([diveseg2], [self.airtank], self.profile0)
        self.profile1.do_surface_interval(20 * 60)
        self.profile1.do_dive()

    def test_rt(self):
        assert seconds_to_mmss(self.profile1.run_time) == ' 68:09', \
            'bad dive runtime ? (%s)' \
            % seconds_to_mmss(self.profile1.run_time)

    def test_otu(self):
        self.assertAlmostEqual(self.profile1.model.ox_tox.otu,
                               40.0702502936, 7, 'bad dive OTU ? (%s)'
                               % self.profile1.model.ox_tox.otu)

    def test_cns(self):
        self.assertAlmostEqual(self.profile1.model.ox_tox.cns * 100,
                               14.3091665925, 7, 'bad dive CNS ? (%s)'
                               % (self.profile1.model.ox_tox.cns * 100))

    def test_tank_cons(self):
        self.assertAlmostEqual(self.airtank12.used_gas, 2115.5196384,
                               7, 'bad used gas (%s)'
                               % self.airtank12.used_gas)

    def test_tank_cons_rule(self):
        self.assertEqual(self.profile1.tanks[0].check_rule(), True,
                         'Wrong tank status : it should pass the remaining '
                         'gas rule test (result:%s)'
                         % self.profile1.tanks[0].check_rule())

    def test_no_flight(self):
        no_flight_time = self.profile1.no_flight_time()
        self.assertEqual(no_flight_time, 5460, 'Bad no flight time: %s'
                         % no_flight_time)

    def test_no_flight_wo_exc(self):
        no_flight_time = self.profile1.no_flight_time_wo_exception()
        self.assertEqual(no_flight_time, 5460, 'Bad no flight time: %s'
                         % no_flight_time)

    def test_surfaceint(self):
        self.assertEqual(self.profile1.get_surface_interval(),
                         ' 20:00',
                         'wrong surface interval:%s'
                         % self.profile1.get_surface_interval())
开发者ID:hordurk,项目名称:dipplanner,代码行数:57,代码来源:dive_repetitive_air_test.py

示例10: TestRepetitiveTxDive3

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestRepetitiveTxDive3(TestDive):

    def setUp(self):
        TestDive.setUp(self)

        diveseg1 = SegmentDive(55, 20 * 60, self.txtank1, 0)
        self.profile0 = Dive([diveseg1], [self.txtank1])
        self.profile0.do_dive()

        diveseg2 = SegmentDive(50, 20 * 60, self.txtank1, 0)
        self.profile1 = Dive([diveseg2], [self.txtank1], self.profile0)
        self.profile1.do_surface_interval(30 * 60)
        self.profile1.do_dive()

        diveseg3 = SegmentDive(35, 35 * 60, self.txtank1, 0)
        self.profile2 = Dive([diveseg3], [self.txtank1], self.profile1)
        self.profile2.do_surface_interval(60 * 60)

        # self.profile2.refill_tanks()

        self.profile2.do_dive()

        diveseg4 = SegmentDive(55, 20 * 60, self.txtank1, 0)
        self.profile3 = Dive([diveseg4], [self.txtank1], self.profile2)
        self.profile3.do_surface_interval(12 * 60 * 60)

        # self.profile3.refill_tanks()

        self.profile3.do_dive()

    def test_rt(self):
        assert seconds_to_mmss(self.profile3.run_time) == ' 72:40', \
            'bad dive runtime ? (%s)' \
            % seconds_to_mmss(self.profile3.run_time)

    def test_otu(self):
        self.assertAlmostEqual(self.profile3.model.ox_tox.otu,
                               115.825853006, 7, 'bad dive OTU ? (%s)'
                               % self.profile3.model.ox_tox.otu)

    def test_cns(self):
        self.assertAlmostEqual(self.profile3.model.ox_tox.cns * 100,
                               12.6208702934, 7, 'bad dive CNS ? (%s)'
                               % (self.profile3.model.ox_tox.cns * 100))

    def test_tank_cons(self):
        self.assertAlmostEqual(self.txtank1.used_gas, 3350.41341833, 7,
                               'bad used gas (%s)'
                               % self.txtank1.used_gas)

    def test_tank_cons_rule(self):
        self.assertEqual(self.profile3.tanks[0].check_rule(), True,
                         'Wrong tank status : it should pass the remaining '
                         'gas rule test (result:%s)'
                         % self.profile2.tanks[0].check_rule())

    def test_no_flight(self):
        no_flight_time = self.profile3.no_flight_time()
        self.assertEqual(no_flight_time, 7380, 'Bad no flight time: %s'
                         % no_flight_time)
开发者ID:hordurk,项目名称:dipplanner,代码行数:62,代码来源:dive_repetitive_tx_test.py

示例11: TestDiveAirDiveOutput2

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveAirDiveOutput2(TestDive):

    def setUp(self):
        TestDive.setUp(self)
        diveseg2 = SegmentDive(20, 30 * 60, self.airtank, 0)
        self.profile2 = Dive([diveseg2], [self.airtank])
        self.profile2.do_dive()

    def test_segment1(self):
        self.assertEqual(str(self.profile2.output_segments[0]),
                         ' DESCENT: at  20m for   1:00 [RT:  1:00], '
                         'on Air,  SP:0.0, END:19m',
                         'bad segment (%s)'
                         % self.profile2.output_segments[0])

    def test_segment2(self):
        self.assertEqual(str(self.profile2.output_segments[1]),
                         '   CONST: at  20m for  29:00 [RT: 30:00], '
                         'on Air,  SP:0.0, END:19m',
                         'bad segment (%s)'
                         % self.profile2.output_segments[1])

    def test_segment3(self):
        self.assertEqual(str(self.profile2.output_segments[2]),
                         '  ASCENT: at   9m for   1:06 [RT: 31:06], '
                         'on Air,  SP:0.0, END:8m',
                         'bad segment (%s)'
                         % self.profile2.output_segments[2])

    def test_segment4(self):
        self.assertEqual(str(self.profile2.output_segments[3]),
                         '    DECO: at   9m for   0:01 [RT: 31:07], '
                         'on Air,  SP:0.0, END:8m',
                         'bad segment (%s)'
                         % self.profile2.output_segments[3])

    def test_segment5(self):
        self.assertEqual(str(self.profile2.output_segments[4]),
                         '    DECO: at   6m for   0:01 [RT: 31:08], '
                         'on Air,  SP:0.0, END:5m',
                         'bad segment (%s)'
                         % self.profile2.output_segments[4])

    def test_segment6(self):
        self.assertEqual(str(self.profile2.output_segments[5]),
                         '    DECO: at   3m for   0:56 [RT: 32:04], '
                         'on Air,  SP:0.0, END:2m',
                         'bad segment (%s)'
                         % self.profile2.output_segments[5])
开发者ID:hordurk,项目名称:dipplanner,代码行数:51,代码来源:dive_test.py

示例12: TestDiveAir70m10min

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveAir70m10min(TestDive):
    """Test air 70m 10min."""

    params = ((70, 10), )

    def runTest(self):
        """Run one test."""
        try:
            diveseg1 = SegmentDive(self.params[0][0], self.params[0][1] * 60,
                                   self.airdouble, 0)
            self.profile1 = Dive([diveseg1], [self.airdouble])
            self.profile1.do_dive()
        except UnauthorizedMod:
            pass
        else:
            self.fail("should raise UnauthorizedMod")
开发者ID:ThomasChiroux,项目名称:dipplanner,代码行数:18,代码来源:dive_air_test.py

示例13: TestRepetitiveTxDive1

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestRepetitiveTxDive1(TestDive):

    def setUp(self):
        TestDive.setUp(self)

        diveseg1 = SegmentDive(55, 20 * 60, self.txtank1, 0)
        self.profile0 = Dive([diveseg1], [self.txtank1])
        self.profile0.do_dive()

        diveseg2 = SegmentDive(50, 20 * 60, self.txtank1, 0)
        self.profile1 = Dive([diveseg2], [self.txtank1], self.profile0)
        self.profile1.do_surface_interval(20 * 60)

        # self.profile1.refill_tanks()

        self.profile1.do_dive()

    def test_rt(self):
        assert seconds_to_mmss(self.profile1.run_time) == '124:44', \
            'bad dive runtime ? (%s)' \
            % seconds_to_mmss(self.profile1.run_time)

    def test_otu(self):
        self.assertAlmostEqual(self.profile1.model.ox_tox.otu,
                               55.5549635111, 7, 'bad dive OTU ? (%s)'
                               % self.profile1.model.ox_tox.otu)

    def test_cns(self):
        self.assertAlmostEqual(self.profile1.model.ox_tox.cns * 100,
                               21.1631708375, 7, 'bad dive CNS ? (%s)'
                               % (self.profile1.model.ox_tox.cns * 100))

    def test_tank_cons(self):
        self.assertAlmostEqual(self.txtank1.used_gas, 4006.7619273, 7,
                               'bad used gas (%s)'
                               % self.txtank1.used_gas)

    def test_tank_cons_rule(self):
        self.assertEqual(self.profile1.tanks[0].check_rule(), True,
                         'Wrong tank status : it should pass the remaining '
                         'gas rule test (result:%s)'
                         % self.profile1.tanks[0].check_rule())

    def test_no_flight(self):
        no_flight_time = self.profile1.no_flight_time()
        self.assertEqual(no_flight_time, 12660, 'Bad no flight time: %s'
                         % no_flight_time)
开发者ID:hordurk,项目名称:dipplanner,代码行数:49,代码来源:dive_repetitive_tx_test.py

示例14: TestDiveTxNormoDecoNx8070m10min

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveTxNormoDecoNx8070m10min(TestDive):
    """Test txnormo 70m 10min."""

    params = ((70, 10), )

    def runTest(self):
        """Run one test."""
        try:
            diveseg1 = SegmentDive(self.params[0][0], self.params[0][1] * 60,
                                   self.txtanknormodbl, 0)
            self.profile1 = Dive([diveseg1], [self.txtanknormodbl,
                                              self.deco1])
            self.profile1.do_dive()
        except UnauthorizedMod:
            pass
        else:
            self.fail("should raise UnauthorizedMod")
开发者ID:ThomasChiroux,项目名称:dipplanner,代码行数:19,代码来源:dive_txnormo_test.py

示例15: TestDiveTxHypo160m10min

# 需要导入模块: from dipplanner.dive import Dive [as 别名]
# 或者: from dipplanner.dive.Dive import do_dive [as 别名]
class TestDiveTxHypo160m10min(TestDive):
    """Test TxHypo 160m 10min."""

    params = ((160, 10), )

    def runTest(self):
        """Run one test."""
        try:
            diveseg1 = SegmentDive(self.params[0][0], self.params[0][1] * 60,
                                   self.txhypo, 0)
            self.profile1 = Dive([diveseg1], [self.txtravel,
                                              self.txhypo, self.deco1])
            self.profile1.do_dive()
        except UnauthorizedMod:
            pass
        else:
            self.fail('should raise UnauthorizedMod')
开发者ID:ThomasChiroux,项目名称:dipplanner,代码行数:19,代码来源:dive_txhypo_test.py


注:本文中的dipplanner.dive.Dive.do_dive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。