예제 #1
0
    def test_error_variance(self):
        d = Capability()
        d.vss = 4.0
        d.variance = 0.5

        # Should result in a ValueError
        try:
            d.calculate_vss(method='nada')
        except ValueError:
            assert True
        else:
            assert False
예제 #2
0
    def test_error_variance(self):
        d = Capability()
        d.vss = 4.0
        d.variance = 0.5

        # Should result in a ValueError
        try:
            d.calculate_vss(method='nada')
        except ValueError:
            assert True
        else:
            assert False
예제 #3
0
    def test_random_variance(self):
        d = Capability()
        d.vss = 4.0
        d.variance = 0.5

        real_vss = d.calculate_vss(method='random')
        assert real_vss >= d.vss - d.variance
        assert real_vss <= d.vss + d.variance
예제 #4
0
    def test_random_variance(self):
        d = Capability()
        d.vss = 4.0
        d.variance = 0.5

        real_vss = d.calculate_vss(method='random')
        assert real_vss >= d.vss - d.variance
        assert real_vss <= d.vss + d.variance
예제 #5
0
    def test_from_json(self):
        data = open(os.path.normpath(os.path.join(os.path.dirname(__file__),"./resources/files/capability_behavior.json"))).read()
        d = Capability(json=data)

        assert d.vss == 5.0
        assert d.variance == 0.0
        assert d.non_swim_turning == "random"
        assert d.swim_turning == "random"
        assert d.calculated_vss == 5.0
        assert d.calculate_vss() == 5.0
예제 #6
0
    def test_gaussian_variance(self):
        d = Capability()
        d.vss = 4.0
        d.variance = 0.5

        max_deviation = d.variance * 6

        real_vss = d.calculate_vss(method='gaussian')
        assert real_vss >= d.vss - max_deviation
        assert real_vss <= d.vss + max_deviation
예제 #7
0
    def test_gaussian_variance(self):
        d = Capability()
        d.vss = 4.0
        d.variance = 0.5

        max_deviation = d.variance * 6

        real_vss = d.calculate_vss(method='gaussian')
        assert real_vss >= d.vss - max_deviation
        assert real_vss <= d.vss + max_deviation
예제 #8
0
    def test_from_json(self):
        data = open(os.path.normpath(os.path.join(os.path.dirname(__file__), "./resources/files/capability_behavior.json"))).read()
        d = Capability(json=data)

        assert d.vss == 5.0
        assert d.variance == 0.0
        assert d.non_swim_turning == "random"
        assert d.swim_turning == "random"
        assert d.calculated_vss == 5.0
        assert d.calculate_vss() == 5.0