Exemplo n.º 1
0
 def test_add_get_primary_sensors_version(self):
     w = Workflow('test', 5)
     w.add_primary_sensor('atsr-e2', '1995-06-01', '1996-01-01',
                          'version_5')
     self.assertEqual([
         Sensor('atsr-e2', Period((1995, 6, 1), (1996, 1, 1)), 'version_5')
     ], w._get_primary_sensors())
Exemplo n.º 2
0
    def test_add_get_primary_sensors_multiple(self):
        w = Workflow('test', 5)
        w.add_primary_sensor('atsr-e2', '1995-06-01', '1996-01-01')
        w.add_primary_sensor('atsr-e1', '1991-06-01', '1995-01-01')
        w.add_primary_sensor('atsr-en', '1996-01-01', '1998-01-01')

        sensors = w._get_primary_sensors()
        self.assertEqual([Sensor('atsr-en', Period((1996, 1, 1), (1998, 1, 1))),
                          Sensor('atsr-e2', Period((1995, 6, 1), (1996, 1, 1))),
                          Sensor('atsr-e1', Period((1991, 6, 1), (1995, 1, 1)))], sensors)
Exemplo n.º 3
0
    def test_add_primary_sensors_to_workflow(self):
        w = Workflow('test')
        w.add_primary_sensor('atsr.3', (2007, 1, 1), (2008, 1, 1))
        self.assertEqual(1, len(w._get_primary_sensors()))

        try:
            w.add_primary_sensor('atsr.3', (2007, 1, 1), (2008, 1, 1))
            self.fail()
        except exceptions.ValueError:
            pass

        try:
            w.add_primary_sensor('atsr.3', (2007, 7, 1), (2008, 1, 1))
            self.fail()
        except exceptions.ValueError:
            pass

        w.add_primary_sensor('atsr.2', (2007, 1, 1), (2008, 1, 1))
        self.assertEqual(2, len(w._get_primary_sensors()))
        w.add_primary_sensor('atsr.3', (2008, 1, 1), (2009, 1, 1))
        self.assertEqual(3, len(w._get_primary_sensors()))
Exemplo n.º 4
0
    def test_add_get_primary_sensors_multiple(self):
        w = Workflow('test', 5)
        w.add_primary_sensor('atsr-e2', '1995-06-01', '1996-01-01')
        w.add_primary_sensor('atsr-e1', '1991-06-01', '1995-01-01')
        w.add_primary_sensor('atsr-en', '1996-01-01', '1998-01-01')

        sensors = w._get_primary_sensors()
        self.assertEqual([
            Sensor('atsr-en', Period((1996, 1, 1), (1998, 1, 1))),
            Sensor('atsr-e2', Period((1995, 6, 1), (1996, 1, 1))),
            Sensor('atsr-e1', Period((1991, 6, 1), (1995, 1, 1)))
        ], sensors)
Exemplo n.º 5
0
    def test_add_primary_sensors_to_workflow(self):
        w = Workflow('test')
        w.add_primary_sensor('atsr.3', (2007, 1, 1), (2008, 1, 1))
        self.assertEqual(1, len(w._get_primary_sensors()))

        try:
            w.add_primary_sensor('atsr.3', (2007, 1, 1), (2008, 1, 1))
            self.fail()
        except exceptions.ValueError:
            pass

        try:
            w.add_primary_sensor('atsr.3', (2007, 7, 1), (2008, 1, 1))
            self.fail()
        except exceptions.ValueError:
            pass

        w.add_primary_sensor('atsr.2', (2007, 1, 1), (2008, 1, 1))
        self.assertEqual(2, len(w._get_primary_sensors()))
        w.add_primary_sensor('atsr.3', (2008, 1, 1), (2009, 1, 1))
        self.assertEqual(3, len(w._get_primary_sensors()))
Exemplo n.º 6
0
 def test_get_primary_sensors_empty_list(self):
     w = Workflow('test', 5)
     self.assertEqual([], w._get_primary_sensors())
Exemplo n.º 7
0
 def test_add_get_primary_sensors_version(self):
     w = Workflow('test', 5)
     w.add_primary_sensor('atsr-e2', '1995-06-01', '1996-01-01', 'version_5')
     self.assertEqual([Sensor('atsr-e2', Period((1995, 6, 1), (1996, 1, 1)), 'version_5')], w._get_primary_sensors())
Exemplo n.º 8
0
 def test_get_primary_sensors_empty_list(self):
     w = Workflow('test', 5)
     self.assertEqual([], w._get_primary_sensors())