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


Python dive.Dive类代码示例

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


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

示例1: TestDiveAirDiveOutput_woExc

class TestDiveAirDiveOutput_woExc(TestDive):
    """Test segments output for air dive 1 without exc."""

    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_without_exceptions()

    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,代码行数:34,代码来源:dive_test.py

示例2: TestDiveTxDiveOutput1

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,代码行数:33,代码来源:dive_test.py

示例3: setUp

    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()
开发者ID:hordurk,项目名称:dipplanner,代码行数:27,代码来源:dive_repetitive_tx_test.py

示例4: TestDiveAirDiveOutput2

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,代码行数:29,代码来源:dive_test.py

示例5: TestDiveAirDiveRunTime3

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,代码行数:9,代码来源:dive_test.py

示例6: TestDiveTxDiveRunTime1

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,代码行数:9,代码来源:dive_test.py

示例7: TestDiveAirDiveRunTime1

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,代码行数:9,代码来源:dive_test.py

示例8: TestDiveAirDiveRunTime2

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,代码行数:9,代码来源:dive_test.py

示例9: TestDiveNotEnoughGas1

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,代码行数:10,代码来源:dive_test.py

示例10: TestRepetitiveDive1

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,代码行数:55,代码来源:dive_repetitive_air_test.py

示例11: setUp

    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()
开发者ID:hordurk,项目名称:dipplanner,代码行数:11,代码来源:dive_repetitive_air_test.py

示例12: TestDiveAirDiveOutput2

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,代码行数:49,代码来源:dive_test.py

示例13: TestDiveAir70m10min

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,代码行数:16,代码来源:dive_air_test.py

示例14: setUp

 def setUp(self):
     """Init of the tests."""
     super().setUp()
     diveseg3 = SegmentDive(55, 30 * 60, self.airdouble, 0)
     self.profile1 = Dive([diveseg3], [self.airdouble, self.decoo2,
                                       self.deco2])
     self.profile1.do_dive()
开发者ID:ThomasChiroux,项目名称:dipplanner,代码行数:7,代码来源:dive_test.py

示例15: TestDiveTxHypo160m10min

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,代码行数:17,代码来源:dive_txhypo_test.py


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