Exemple #1
0
 def setUp(self):
     self.cub = data_dir / 'pattern.cub'
     self.cubpvl = pvl.PVLModule(IsisCube=pvl.PVLObject(Core=pvl.PVLObject(
         StartByte=65537,
         Format='Tile',
         TileSamples=128,
         TileLines=128,
         Dimensions=pvl.PVLGroup(Samples=90, Lines=90, Bands=1),
         Pixels=pvl.PVLGroup(
             Type='Real', ByteOrder='Lsb', Base=0.0, Multiplier=1.0))),
                                 Label=pvl.PVLObject(Bytes=65536))
Exemple #2
0
def test_equlity():
    assert not pvl.PVLModule()
    assert not pvl.PVLGroup()
    assert not pvl.PVLObject()

    assert not not pvl.PVLModule(a=1)
    assert not not pvl.PVLGroup(a=1)
    assert not not pvl.PVLObject(a=1)

    assert pvl.PVLModule() == pvl.PVLModule()
    assert pvl.PVLModule() != pvl.PVLGroup()
    assert pvl.PVLModule() != pvl.PVLObject()

    assert pvl.PVLGroup() != pvl.PVLModule()
    assert pvl.PVLGroup() == pvl.PVLGroup()
    assert pvl.PVLGroup() != pvl.PVLObject()

    assert pvl.PVLObject() != pvl.PVLModule()
    assert pvl.PVLObject() != pvl.PVLGroup()
    assert pvl.PVLObject() == pvl.PVLObject()

    assert pvl.PVLModule() != pvl.PVLModule(a=1)
    assert pvl.PVLModule(a=1) == pvl.PVLModule(a=1)
    assert pvl.PVLModule(a=1) == pvl.PVLModule([('a', 1)])
    assert pvl.PVLModule(a=1) == pvl.PVLModule({'a': 1})
    assert pvl.PVLModule(a=1) != pvl.PVLModule(b=1)
    assert pvl.PVLModule(a=1) != pvl.PVLModule(a=2)
Exemple #3
0
 def setUp(self):
     self.simple = data_dir / 'pds3' / 'simple_image_1.lbl'
     self.simplePVL = pvl.PVLModule({
         'PDS_VERSION_ID':
         'PDS3',
         'RECORD_TYPE':
         'FIXED_LENGTH',
         'RECORD_BYTES':
         824,
         'LABEL_RECORDS':
         1,
         'FILE_RECORDS':
         601,
         '^IMAGE':
         2,
         'IMAGE':
         pvl.PVLObject({
             'LINES': 600,
             'LINE_SAMPLES': 824,
             'SAMPLE_TYPE': 'MSB_INTEGER',
             'SAMPLE_BITS': 8,
             'MEAN': 51.67785396440129,
             'MEDIAN': 50.0,
             'MINIMUM': 0,
             'MAXIMUM': 255,
             'STANDARD_DEVIATION': 16.97019,
             'CHECKSUM': 25549531
         })
     })
Exemple #4
0
 def setUp(self):
     self.simple = data_dir / "pds3" / "simple_image_1.lbl"
     rawurl = "https://raw.githubusercontent.com/planetarypy/pvl/main/"
     self.url = rawurl + str(self.simple)
     self.simplePVL = pvl.PVLModule(
         {
             "PDS_VERSION_ID": "PDS3",
             "RECORD_TYPE": "FIXED_LENGTH",
             "RECORD_BYTES": 824,
             "LABEL_RECORDS": 1,
             "FILE_RECORDS": 601,
             "^IMAGE": 2,
             "IMAGE": pvl.PVLObject(
                 {
                     "LINES": 600,
                     "LINE_SAMPLES": 824,
                     "SAMPLE_TYPE": "MSB_INTEGER",
                     "SAMPLE_BITS": 8,
                     "MEAN": 51.67785396440129,
                     "MEDIAN": 50.0,
                     "MINIMUM": 0,
                     "MAXIMUM": 255,
                     "STANDARD_DEVIATION": 16.97019,
                     "CHECKSUM": 25549531,
                 }
             ),
         }
     )
Exemple #5
0
 def setUp(self):
     self.cub = data_dir / "pattern.cub"
     self.cubpvl = pvl.PVLModule(
         IsisCube=pvl.PVLObject(
             Core=pvl.PVLObject(
                 StartByte=65537,
                 Format="Tile",
                 TileSamples=128,
                 TileLines=128,
                 Dimensions=pvl.PVLGroup(Samples=90, Lines=90, Bands=1),
                 Pixels=pvl.PVLGroup(
                     Type="Real", ByteOrder="Lsb", Base=0.0, Multiplier=1.0
                 ),
             )
         ),
         Label=pvl.PVLObject(Bytes=65536),
     )
Exemple #6
0

@pytest.mark.parametrize('label, expected, expected_errors', [
    ('broken1.lbl', [('foo', 'bar'), ('life', EV(2)),
                     ('monty', 'python')], [2]),
    ('broken2.lbl', [('foo', 'bar'), ('life', EV(2))], [2]),
    ('broken3.lbl', [('foo', EV(1)), ('life', 42)], [1]),
    ('broken4.lbl', [('foo', 'bar'), ('life', EV(2)),
                     ('monty', EV(3))], [2, 3]),
    ('broken5.lbl', [('foo', EV(1)), ('life', EV(2)),
                     ('monty', 'python')], [1, 2]),
    ('broken6.lbl', [('foo', EV(1)), ('life', EV(1)),
                     ('monty', EV(1))], [1, 2, 3]),
    ('broken7.lbl', [
        ('foo', 1),
        ('embedded_object', pvl.PVLObject([('foo', 'bar'), ('life', EV(1))]))
    ], [4]),
    ('broken8.lbl', [
        ('foo', 1),
        ('embedded_group', pvl.PVLGroup([('foo', 'bar'), ('life', EV(1))]))
    ], [4]),
    ('broken9.lbl', [('foo', 42), ('bar', EV(1))], [2]),
    ('broken10.lbl', [('foo', Units(42, 'beards')), ('cool', EV(1))], [2]),
    ('broken11.lbl', [('foo', EV(1)), ('cool', [Units(1, 'beards')])], [1]),
    ('broken12.lbl', [('strs', ['a', 'b']), ('empty', EV(2)),
                      ('multiline', ['a', 'b'])], [2]),
    ('broken13.lbl', [('same', 'line'), ('no', 'problem'), ('foo', EV(1)),
                      ('bar', EV(2))], [1, 2]),
    ('broken14.lbl', [('foo', 'bar'), ('weird', EV(3)), ('baz', 'bang')], [3]),
    ('broken15.lbl', [('foo', 'bar'), ('weird', 'comment'),
                      ('baz', EV(4))], [4]),
Exemple #7
0
     "broken5.lbl",
     [("foo", EV(1)), ("life", EV(2)), ("monty", "python")],
     [1, 2],
 ),
 (
     "broken6.lbl",
     [("foo", EV(1)), ("life", EV(1)), ("monty", EV(1))],
     [1, 2, 3],
 ),
 (
     "broken7.lbl",
     [
         ("foo", 1),
         (
             "embedded_object",
             pvl.PVLObject([("foo", "bar"), ("life", EV(1))]),
         ),
     ],
     [4],
 ),
 (
     "broken8.lbl",
     [
         ("foo", 1),
         (
             "embedded_group",
             pvl.PVLGroup([("foo", "bar"), ("life", EV(1))]),
         ),
     ],
     [4],
 ),