Skip to content
Snippets Groups Projects
Select Git revision
  • 7114d34d0fe08070254df80fcee7477ec2db8dda
  • main default protected
  • 1.8.5
  • 1.8.4
  • 1.8.3
  • 1.8.2
  • 1.8.1
  • 1.8.0
  • 1.7.14
  • 1.7.13
  • 1.7.12
  • 1.7.11
  • 1.7.10
  • 1.7.9
  • 1.7.8
  • 1.7.7
  • 1.7.6
  • 1.7.5
  • 1.7.4
  • 1.7.3
  • 1.7.2
  • 1.7.1
22 results

ServletCutout.java

Blame
  • test_model.py 1.56 KiB
    from distutils import dir_util
    import json
    import os
    
    import csmapi
    import pytest
    
    
    # Loads a CSM compliant lib defined by --lib= in the pytest invocation
    def test_loadlib(loadlib):
        assert loadlib is not None
    
    
    @pytest.fixture
    def isd():
        return csmapi.Isd()
    
    @pytest.fixture
    def plugin():
        plugin = csmapi.Plugin.findPlugin('PluginFixture')
        return plugin 
    
    @pytest.fixture
    def model(isd, plugin):
        model_name = "FixtureSensorModel"
        return plugin.constructModelFromISD(isd, model_name)
    
    
    def test_instantiate_model(isd, plugin):
        model_name = "FixtureSensorModel"
        assert plugin.canModelBeConstructedFromISD(isd, model_name)
        assert plugin.canISDBeConvertedToModelState(isd, model_name)
    
    def test_image_to_ground(model):
        assert hasattr(model, 'imageToGround')
        image_coord = csmapi.ImageCoord()
        gnd = model.imageToGround(image_coord, 0)
        assert gnd.x == 0
        assert gnd.y == 0
        assert gnd.z == 0
    
    def test_model_version(model):
        assert model.getVersion().version() == '0.1.0'
    
    def test_bad_get_image_time(model):
        img_coord = csmapi.ImageCoord(-1,-1)
        with pytest.raises(RuntimeError) as r:
            model.getImageTime(img_coord)
        
    def test_ground_to_image(model):
        assert hasattr(model, 'groundToImage')
        gnd_coord = csmapi.EcefCoord(0,0,0)
        img = model.groundToImage(gnd_coord, 0)
        assert img.samp == 0
        assert img.line == 0
    
    def test_bad_ground_to_image(model):
        gnd_coord = csmapi.EcefCoord(-1, -1, 0)
        with pytest.warns(Warning) as w:
            img = model.groundToImage(gnd_coord, 0)
            assert len(w) == 1