コード例 #1
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_2_return_precios(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[2])
     precios = adjudicacion.get_precios()
     self.assertTrue(precios[0]["moneda"] == "$" and precios[0]["valor"] == 19906)
     self.assertTrue(precios[1]["moneda"] == "$" and precios[1]["valor"] == 19621.45)
     self.assertTrue(precios[2]["moneda"] == "$" and precios[2]["valor"] == 686950)
     self.assertTrue(precios[3]["moneda"] == "$" and precios[3]["valor"] == 34893.80)
コード例 #2
0
 def test_when_adjudicacion_2_return_proveedores(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[2])
     proveedores = adjudicacion.get_proveedores()
     self.assertTrue("LEONARDO MAZZEO" in proveedores)
     self.assertTrue("DISTRIBUIDORA SYNERGIA S.R.L." in proveedores)
     self.assertTrue("SUALIER SA" in proveedores)
     self.assertTrue("VIMI S.A." in proveedores)
コード例 #3
0
 def test_when_adjudicacion_3_return_precios(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[3])
     precios = adjudicacion.get_precios()
     self.assertTrue(precios[0]["moneda"] == "$"
                     and precios[0]["valor"] == 594)
     self.assertTrue(precios[1]["moneda"] == "$"
                     and precios[1]["valor"] == 8577)
コード例 #4
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_2_return_proveedores(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[2])
     proveedores = adjudicacion.get_proveedores()
     self.assertTrue("LEONARDO MAZZEO" in proveedores)
     self.assertTrue("DISTRIBUIDORA SYNERGIA S.R.L." in proveedores)
     self.assertTrue("SUALIER SA" in proveedores)
     self.assertTrue("VIMI S.A." in proveedores)
コード例 #5
0
    def test_when_adjudicacion_0_return_proveedor2(self):
        adjudicacion = Adjudicacion(fixtures.adjudicaciones[8])
        proveedores = adjudicacion.get_proveedores()
        precios = adjudicacion.get_precios()

        self.assertTrue("LA LEY S.A." in proveedores)
        self.assertEqual("LA LEY S.A.", proveedores[0])
        self.assertEqual(len(proveedores), len(precios))
コード例 #6
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
    def test_when_adjudicacion_0_return_proveedor2(self):
        adjudicacion = Adjudicacion(fixtures.adjudicaciones[8])
        proveedores = adjudicacion.get_proveedores()
        precios = adjudicacion.get_precios()

        self.assertTrue("LA LEY S.A." in proveedores)
        self.assertEqual("LA LEY S.A.", proveedores[0])
        self.assertEqual(len(proveedores), len(precios))
コード例 #7
0
 def test_when_adjudicacion_2_return_precios(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[2])
     precios = adjudicacion.get_precios()
     self.assertTrue(precios[0]["moneda"] == "$"
                     and precios[0]["valor"] == 19906)
     self.assertTrue(precios[1]["moneda"] == "$"
                     and precios[1]["valor"] == 19621.45)
     self.assertTrue(precios[2]["moneda"] == "$"
                     and precios[2]["valor"] == 686950)
     self.assertTrue(precios[3]["moneda"] == "$"
                     and precios[3]["valor"] == 34893.80)
コード例 #8
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_1_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[1])
     self.assertEqual(adjudicacion.get_objeto(), "Cursos de Mantenimiento de Motores T-56.")
コード例 #9
0
 def test_when_empty_return_texto_empty(self):
     adjudicacion = Adjudicacion()
     self.assertFalse(bool(adjudicacion.get_texto()))
コード例 #10
0
 def test_when_adjudicacion_2_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[2])
     self.assertEqual(
         adjudicacion.get_objeto(),
         "Adquisición de Combustibles y Lubricantes para el funcionamiento del Instituto en el 4to Trimestre 2011 y 1er Trimestre 2012."
     )
コード例 #11
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_6_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[6])
     self.assertEqual(adjudicacion.get_objeto(), "Mantenimiento Edilicio.")
コード例 #12
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_4_return_proveedores(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[4])
     proveedores = adjudicacion.get_proveedores()    
     self.assertTrue("FEDERICO LOPEZ." in proveedores)
コード例 #13
0
 def test_when_adjudicacion_0_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[0])
     self.assertEqual(
         adjudicacion.get_entidad_publica(),
         "FUERZA AEREA ARGENTINA ESTADO MAYOR GENERAL DE LA FUERZA AEREA INSTITUTO DE FORMACION EZEIZA"
     )
コード例 #14
0
 def test_when_adjudicacion_6_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[6])
     self.assertEqual(adjudicacion.get_objeto(), "Mantenimiento Edilicio.")
コード例 #15
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_0_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[0])
     self.assertEqual(adjudicacion.get_entidad_publica(), 
         "FUERZA AEREA ARGENTINA ESTADO MAYOR GENERAL DE LA FUERZA AEREA INSTITUTO DE FORMACION EZEIZA")
コード例 #16
0
 def test_when_adjudicacion_4_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[4])
     self.assertEqual(adjudicacion.get_objeto(),
                      "Adquisición de Chombas de Piqué identificatorias.")
コード例 #17
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_4_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[4])
     self.assertEqual(adjudicacion.get_entidad_publica(), 
         "ADMINISTRACION FEDERAL DE INGRESOS PUBLICOS DIRECCION REGIONAL ADUANERA MENDOZA")
コード例 #18
0
 def test_when_nestor_return_texto_nestor(self):
     adjudicacion = Adjudicacion("Nestor")
     self.assertEqual(adjudicacion.get_texto(), "Nestor")
コード例 #19
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_1_return_proveedor(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[1])
     self.assertTrue("CAE USA INC." in adjudicacion.get_proveedores());
コード例 #20
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_1_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[1])
     self.assertEqual(adjudicacion.get_entidad_publica(), 
         "FUERZA AEREA ARGENTINA DIRECCION GENERAL DE INTENDENCIA DIRECCION DE CONTRATACIONES")
コード例 #21
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_0_return_precios(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[0])
     precios = adjudicacion.get_precios()
     self.assertTrue(precios[0]["moneda"] == "$" and precios[0]["valor"] == 87900)
コード例 #22
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_0_return_proveedor3(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[9])
     proveedores = adjudicacion.get_proveedores()
     precios = adjudicacion.get_precios()
     self.assertEqual(len(proveedores), len(precios))
コード例 #23
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_0_return_proveedor(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[0])
     proveedores = adjudicacion.get_proveedores()
     self.assertTrue("METEO S.A. " in proveedores)
コード例 #24
0
 def test_when_adjudicacion_3_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[3])
     self.assertEqual(
         adjudicacion.get_objeto(),
         "Adquisición de Equipamiento Técnico para la Dirección de Policía Científica."
     )
コード例 #25
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_1_return_precios(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[1])
     precios = adjudicacion.get_precios()
     self.assertTrue(precios[0]["moneda"] == "U$S" and precios[0]["valor"] == 74076)
コード例 #26
0
 def test_when_adjudicacion_3_return_proveedores(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[3])
     proveedores = adjudicacion.get_proveedores()
     self.assertTrue("PROMETIN S.A." in proveedores)
     self.assertTrue("TECNOELECTRIC S.R.L." in proveedores)
コード例 #27
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_empty_return_texto_empty(self):
     adjudicacion = Adjudicacion()
     self.assertFalse(bool(adjudicacion.get_texto()))
コード例 #28
0
 def test_when_adjudicacion_4_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[4])
     self.assertEqual(
         adjudicacion.get_entidad_publica(),
         "ADMINISTRACION FEDERAL DE INGRESOS PUBLICOS DIRECCION REGIONAL ADUANERA MENDOZA"
     )
コード例 #29
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_2_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[2])
     self.assertEqual(adjudicacion.get_entidad_publica(), 
         "EJERCITO ARGENTINO COLEGIO MILITAR DE LA NACION")
コード例 #30
0
 def test_when_adjudicacion_4_return_proveedores(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[4])
     proveedores = adjudicacion.get_proveedores()
     self.assertTrue("FEDERICO LOPEZ." in proveedores)
コード例 #31
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_2_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[2])
     self.assertEqual(adjudicacion.get_objeto(), "Adquisición de Combustibles y Lubricantes para el funcionamiento del Instituto en el 4to Trimestre 2011 y 1er Trimestre 2012.")
コード例 #32
0
 def test_when_adjudicacion_5_return_precios(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[5])
     precios = adjudicacion.get_precios()
     self.assertTrue(
         precios[0]["moneda"] == "$" and precios[0]["valor"] == 33900, 00)
コード例 #33
0
 def test_when_adjudicacion_1_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[1])
     self.assertEqual(
         adjudicacion.get_entidad_publica(),
         "FUERZA AEREA ARGENTINA DIRECCION GENERAL DE INTENDENCIA DIRECCION DE CONTRATACIONES"
     )
コード例 #34
0
 def test_when_adjudicacion_0_return_proveedor(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[0])
     proveedores = adjudicacion.get_proveedores()
     self.assertTrue("METEO S.A. " in proveedores)
コード例 #35
0
 def test_when_adjudicacion_1_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[1])
     self.assertEqual(adjudicacion.get_objeto(),
                      "Cursos de Mantenimiento de Motores T-56.")
コード例 #36
0
 def test_when_adjudicacion_0_return_proveedor3(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[9])
     proveedores = adjudicacion.get_proveedores()
     precios = adjudicacion.get_precios()
     self.assertEqual(len(proveedores), len(precios))
コード例 #37
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_4_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[4])
     self.assertEqual(adjudicacion.get_objeto(), "Adquisición de Chombas de Piqué identificatorias.")
コード例 #38
0
 def test_when_adjudicacion_1_return_proveedor(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[1])
     self.assertTrue("CAE USA INC." in adjudicacion.get_proveedores())
コード例 #39
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_3_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[3])
     self.assertEqual(adjudicacion.get_entidad_publica(), 
         "GENDARMERIA NACIONAL ARGENTINA")
コード例 #40
0
 def test_when_adjudicacion_1_return_precios(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[1])
     precios = adjudicacion.get_precios()
     self.assertTrue(precios[0]["moneda"] == "U$S"
                     and precios[0]["valor"] == 74076)
コード例 #41
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_3_return_objeto(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[3])
     self.assertEqual(adjudicacion.get_objeto(), "Adquisición de Equipamiento Técnico para la Dirección de Policía Científica.")
コード例 #42
0
 def test_when_adjudicacion_2_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[2])
     self.assertEqual(adjudicacion.get_entidad_publica(),
                      "EJERCITO ARGENTINO COLEGIO MILITAR DE LA NACION")
コード例 #43
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_adjudicacion_3_return_proveedores(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[3])
     proveedores = adjudicacion.get_proveedores()
     self.assertTrue("PROMETIN S.A." in proveedores)
     self.assertTrue("TECNOELECTRIC S.R.L." in proveedores)
コード例 #44
0
def parsea_boletin(boletin_str, cursor, filename=""):
    boletin = Boletin(boletin_str)
    adjudicaciones_str = boletin.get_modulos_seccion("Adjudicaciones")
    totales = {
        "adjudicaciones": 0,
        "sociedades": 0,
        "oferentes": 0,
        "reparticiones": 0
    }

    boletin_regex = re.compile("-", re.IGNORECASE | re.MULTILINE)
    matchs = boletin_regex.split(filename)

    cursor.execute(db_inserts['boletin'],
                   (matchs[0], matchs[1].replace('.txt', '')))
    boletin_id = cursor.lastrowid

    for adjudicacion_str in adjudicaciones_str:
        adjudicacion = Adjudicacion(adjudicacion_str)

        reparticion = adjudicacion.get_entidad_publica()
        cursor.execute(db_queries['reparticion'],
                       '%' + string.capwords(reparticion) + '%')
        reparticion_id = cursor.fetchone()

        if not reparticion_id:
            cursor.execute(db_inserts['reparticion'], reparticion)
            totales['reparticiones'] += 1
            reparticion_id = cursor.lastrowid
        else:
            reparticion_id = reparticion_id[0]

        try:
            adjudicacion_objeto = adjudicacion.get_objeto()
            cursor.execute(db_inserts['adjudicacion'],
                           (adjudicacion_objeto, adjudicacion.get_texto(),
                            reparticion_id, boletin_id))
        except Exception, e:
            logging.error(logging_msg, filename, adjudicacion.get_texto())

        adjudicacion_id = cursor.lastrowid

        precios = adjudicacion.get_precios()
        proveedores = adjudicacion.get_proveedores()

        for proveedor, precio in zip(proveedores, precios):
            proveedor_title = string.capwords(proveedor)
            cursor.execute(db_queries['sociedad'], proveedor_title)

            sociedad = cursor.fetchone()

            if not sociedad:
                cursor.execute(db_inserts['sociedad'], proveedor_title)
                totales['sociedades'] += 1
                proveedor_id = cursor.lastrowid
            else:
                proveedor_id = sociedad[0]

            #cursor.execute(db_inserts['sociedad2'], proveedor_title)

            precio_str = "{0} {1}".format(precio['moneda'], precio['valor'])
            cursor.execute(db_inserts['oferente'],
                           (proveedor_id, adjudicacion_id, precio_str))

            totales['oferentes'] += 1

        totales['adjudicaciones'] += 1
コード例 #45
0
 def test_when_adjudicacion_3_return_entidad_publica(self):
     adjudicacion = Adjudicacion(fixtures.adjudicaciones[3])
     self.assertEqual(adjudicacion.get_entidad_publica(),
                      "GENDARMERIA NACIONAL ARGENTINA")
コード例 #46
0
def parsea_boletin(boletin_str, cursor, filename = ""):
    boletin = Boletin(boletin_str)
    adjudicaciones_str = boletin.get_modulos_seccion("Adjudicaciones")
    totales = { "adjudicaciones" : 0, 
                "sociedades" : 0, 
                "oferentes" : 0,
                "reparticiones" : 0}

    boletin_regex = re.compile("-",re.IGNORECASE | re.MULTILINE)
    matchs = boletin_regex.split(filename)

    cursor.execute(db_inserts['boletin'], (matchs[0], matchs[1].replace('.txt', '')))
    boletin_id = cursor.lastrowid   

    for adjudicacion_str in adjudicaciones_str:
        adjudicacion = Adjudicacion(adjudicacion_str)
        
        reparticion = adjudicacion.get_entidad_publica()
        cursor.execute(db_queries['reparticion'], '%'+string.capwords(reparticion)+'%')
        reparticion_id = cursor.fetchone()

        if not reparticion_id:
            cursor.execute(db_inserts['reparticion'], reparticion)               
            totales['reparticiones'] += 1
            reparticion_id = cursor.lastrowid
        else:
            reparticion_id = reparticion_id[0]

        try:
            adjudicacion_objeto = adjudicacion.get_objeto()
            cursor.execute(db_inserts['adjudicacion'], 
                        (adjudicacion_objeto, 
                        adjudicacion.get_texto(),
                        reparticion_id,
                        boletin_id))
        except Exception, e:                
            logging.error(logging_msg, filename, adjudicacion.get_texto())

        adjudicacion_id = cursor.lastrowid         

        precios = adjudicacion.get_precios()
        proveedores = adjudicacion.get_proveedores()

        for proveedor, precio in zip(proveedores, precios):
            proveedor_title = string.capwords(proveedor)                
            cursor.execute(db_queries['sociedad'], proveedor_title)

            sociedad = cursor.fetchone()

            if not sociedad:
                cursor.execute(db_inserts['sociedad'], proveedor_title)                        
                totales['sociedades'] += 1
                proveedor_id = cursor.lastrowid
            else:
                proveedor_id = sociedad[0]

            #cursor.execute(db_inserts['sociedad2'], proveedor_title)                        
            
            precio_str = "{0} {1}".format(precio['moneda'], precio['valor'])
            cursor.execute(db_inserts['oferente'], 
                            (proveedor_id, adjudicacion_id, precio_str))

            totales['oferentes'] += 1

        totales['adjudicaciones'] += 1
コード例 #47
0
ファイル: tests.py プロジェクト: avdata99/boletin_oficial
 def test_when_nestor_return_texto_nestor(self):
     adjudicacion = Adjudicacion("Nestor")
     self.assertEqual(adjudicacion.get_texto(), "Nestor")