Example #1
0
    def test_when_boletin_returns_from_seccion_adjudicaciones_copete2(self):
        boletin = Boletin(fixtures.boletines[4]);
        self.assertEqual(boletin.get_desde_copete("Adjudicaciones"),
                         """
EJERCITO ARGENTINO
COMANDO DE REMONTA
""")
Example #2
0
    def test_when_boletin_return_next_copete2(self):
        # Ver bien este donde se utiliza
        boletin = Boletin(fixtures.boletines[3]);
        self.assertEqual(boletin.get_proximo_copete(fixtures.boletines[5]),
                         """#F4080896F#
Servicios
COMUNICACIONES
#I4080375I#""")
Example #3
0
    def test_when_boletin_return_next_copete(self):
        # Ver bien este donde se utiliza
        boletin = Boletin(fixtures.boletines[1]);
        self.assertEqual(boletin.get_proximo_copete(fixtures.boletines[1]),
                         """% 23 % #F4281795F#
Servicios Tres Palabras
Audiovisuales
#I4284951I# % 23 % #N157178/11N#""")
Example #4
0
    def test_when_boletin_return_seccion_servicios(self):
        boletin = Boletin(fixtures.boletines[1]);
        self.assertEqual(boletin.get_seccion("Servicios Tres Palabras Audiovisuales"), """
BLOQUE1
% 23 % #F4285033F#
#I4285622I# % 23 % #N158007/11N#
BLOQUE2
""")
Example #5
0
    def test_when_boletin_return_next_copete2(self):
        # Ver bien este donde se utiliza
        boletin = Boletin(fixtures.boletines[3])
        self.assertEqual(
            boletin.get_proximo_copete(fixtures.boletines[5]), """#F4080896F#
Servicios
COMUNICACIONES
#I4080375I#""")
Example #6
0
    def test_when_boletin_return_next_copete(self):
        # Ver bien este donde se utiliza
        boletin = Boletin(fixtures.boletines[1])
        self.assertEqual(
            boletin.get_proximo_copete(fixtures.boletines[1]),
            """% 23 % #F4281795F#
Servicios Tres Palabras
Audiovisuales
#I4284951I# % 23 % #N157178/11N#""")
Example #7
0
    def test_when_boletin_return_seccion_servicios(self):
        boletin = Boletin(fixtures.boletines[1])
        self.assertEqual(
            boletin.get_seccion("Servicios Tres Palabras Audiovisuales"), """
BLOQUE1
% 23 % #F4285033F#
#I4285622I# % 23 % #N158007/11N#
BLOQUE2
""")
Example #8
0
    def test_when_boletin_returns_from_seccion_dictamenes_de_evaluacion_copete(self):
        boletin = Boletin(fixtures.boletines[1]);
        self.assertEqual(boletin.get_desde_copete("Dictámenes de Evaluación"),
                         """
BANCO DE LA NACION ARGENTINA
BANCO PIRULO
% 19 % #F4285852F#
Locaciones
INMUEBLES (LOC)
#I4286379I# % 19 % #N159046/11N#
AFIP""")
Example #9
0
    def test_when_boletin_returns_from_seccion_dictamenes_de_evaluacion_copete(
            self):
        boletin = Boletin(fixtures.boletines[1])
        self.assertEqual(
            boletin.get_desde_copete("Dictámenes de Evaluación"), """
BANCO DE LA NACION ARGENTINA
BANCO PIRULO
% 19 % #F4285852F#
Locaciones
INMUEBLES (LOC)
#I4286379I# % 19 % #N159046/11N#
AFIP""")
Example #10
0
    def test_when_boletin_return_seccion_adjudicacion(self):
        boletin = Boletin(fixtures.boletines[1]);
        self.assertEqual(boletin.get_seccion("Adjudicaciones"), """
BANCO DE LA NACION ARGENTINA
AREA COMPRAS Y CONTRATACIONES
% 23 % #F4285033F#
#I4285622I# % 23 % #N158007/11N#
BLOQUE1
% 23 % #F4285033F#
#I4285622I# % 23 % #N158007/11N#
BLOQUE2
% 23 % #F4285033F#
#I4285622I# % 23 % #N158007/11N#
BLOQUE3
""")
Example #11
0
    def test_when_boletin_return_seccion_adjudicacion(self):
        boletin = Boletin(fixtures.boletines[1])
        self.assertEqual(
            boletin.get_seccion("Adjudicaciones"), """
BANCO DE LA NACION ARGENTINA
AREA COMPRAS Y CONTRATACIONES
% 23 % #F4285033F#
#I4285622I# % 23 % #N158007/11N#
BLOQUE1
% 23 % #F4285033F#
#I4285622I# % 23 % #N158007/11N#
BLOQUE2
% 23 % #F4285033F#
#I4285622I# % 23 % #N158007/11N#
BLOQUE3
""")
Example #12
0
    def test_when_boletin_return_seccion_adjudicacion2(self):
        boletin = Boletin(fixtures.boletines[3]);
        self.assertEqual(boletin.get_seccion("Adjudicaciones"), """
EJERCITO ARGENTINO
COMANDO DE REMONTA 
Y VETERINARIA SUBASTA PUBLICA 
Nº 03/2010
Expediente Nº AF 10 – 219/5
DESIERTO DE OFERENTES
Objeto de la contratación: Subasta de 450 To-
neladas de Soja a granel, en el Establecimiento 
General Paz, Ruta Provincial 6 Km 153.5 – Or-
dóñez – Provincia de Córdoba.
Observaciones Generales:
Consulta del expediente: Comando de Remonta y 
Veterinaria - División Compras y Contrataciones, 2do 
Piso - Arévalo 3065 - Ciudad Autónóma de Buenos 
Aires - De lunes a viernes de 08:00 a 12:00 horas.
e. 15/03/2010 Nº 24766/10 v. 15/03/2010
""")
Example #13
0
    def test_when_boletin_return_seccion_adjudicacion2(self):
        boletin = Boletin(fixtures.boletines[3])
        self.assertEqual(
            boletin.get_seccion("Adjudicaciones"), """
EJERCITO ARGENTINO
COMANDO DE REMONTA 
Y VETERINARIA SUBASTA PUBLICA 
Nº 03/2010
Expediente Nº AF 10 – 219/5
DESIERTO DE OFERENTES
Objeto de la contratación: Subasta de 450 To-
neladas de Soja a granel, en el Establecimiento 
General Paz, Ruta Provincial 6 Km 153.5 – Or-
dóñez – Provincia de Córdoba.
Observaciones Generales:
Consulta del expediente: Comando de Remonta y 
Veterinaria - División Compras y Contrataciones, 2do 
Piso - Arévalo 3065 - Ciudad Autónóma de Buenos 
Aires - De lunes a viernes de 08:00 a 12:00 horas.
e. 15/03/2010 Nº 24766/10 v. 15/03/2010
""")
Example #14
0
    def test_when_boletin_returns_from_seccion_adjudicaciones_copete(self):
        boletin = Boletin(fixtures.boletines[0]);
        self.assertEqual(boletin.get_desde_copete("Adjudicaciones"),
                         """
BANCO DE LA NACION ARGENTINA
AREA COMPRAS Y CONTRATACIONES""")
Example #15
0
 def test_when_boletin_returns_nothing_from_seccion_adjudicaciones_copete(
         self):
     boletin = Boletin(fixtures.boletines[0].replace(
         "Adjudicaciones",
         r"#I4284951I# % 23 % #N157178/11N#\nAdjudicaciones"))
     self.assertFalse(boletin.get_desde_copete("Adjudicaciones"))
Example #16
0
    def test_when_boletin_returns_from_seccion_adjudicaciones_copete(self):
        boletin = Boletin(fixtures.boletines[0])
        self.assertEqual(
            boletin.get_desde_copete("Adjudicaciones"), """
BANCO DE LA NACION ARGENTINA
AREA COMPRAS Y CONTRATACIONES""")
Example #17
0
    def test_when_boletin_returns_from_seccion_adjudicaciones_copete2(self):
        boletin = Boletin(fixtures.boletines[4])
        self.assertEqual(boletin.get_desde_copete("Adjudicaciones"), """
EJERCITO ARGENTINO
COMANDO DE REMONTA
""")
Example #18
0
 def test_when_boletin_returns_nothing_from_seccion_adjudicaciones_copete(self):
     boletin = Boletin(fixtures.boletines[0].replace("Adjudicaciones", r"#I4284951I# % 23 % #N157178/11N#\nAdjudicaciones"))
     self.assertFalse(boletin.get_desde_copete("Adjudicaciones"))
Example #19
0
 def test_when_boletin_doesnt_has_seccion_adjudicaciones(self):
     boletin = Boletin(fixtures.boletines[1].replace(
         "Adjudicaciones", "Preadjudicaciones"))
     self.assertFalse(boletin.tiene_seccion("Adjudicaciones"))
Example #20
0
 def test_when_boletin_has_seccion_dictamenes_de_evaluacion(self):
     boletin = Boletin(fixtures.boletines[1])
     self.assertTrue(boletin.tiene_seccion("Dictámenes de Evaluación"))
Example #21
0
 def test_when_boletin_has_seccion_servicios(self):
     boletin =  Boletin(fixtures.boletines[1]);
     self.assertTrue(boletin.tiene_seccion("Servicios Tres Palabras Audiovisuales"))
Example #22
0
 def test_when_boletin_returns_modulos_seccion_dictameneS(self):
     boletin = Boletin(fixtures.boletines[1])
     modulos = boletin.get_modulos_seccion("Dictámenes de Evaluación")
     self.assertEqual(len(modulos), 1)
Example #23
0
 def test_when_boletin_has_seccion_dictamenes_de_evaluacion(self):
     boletin =  Boletin(fixtures.boletines[1]);
     self.assertTrue(boletin.tiene_seccion("Dictámenes de Evaluación"))
Example #24
0
 def test_when_boletin_returns_modulos_seccion_adjudicaciones(self):
     boletin = Boletin(fixtures.boletines[1])
     modulos = boletin.get_modulos_seccion("Adjudicaciones")
     self.assertEqual(len(modulos), 4)
     self.assertTrue(modulos[0].find("BANCO DE LA NACION ARGENTINA"))
     self.assertTrue(modulos[2].find("BLOQUE2"))
Example #25
0
    def test_when_boletin_return_seccion_dictamenes_de_evaluacion(self):
        boletin = Boletin(fixtures.boletines[1])
        self.assertEqual(boletin.get_seccion("Dictámenes de Evaluación"), """
BANCO DE LA NACION ARGENTINA
BANCO PIRULO
""")
Example #26
0
 def test_when_boletin_returns_modulos_seccion_adjudicaciones(self):
     boletin = Boletin(fixtures.boletines[1])
     modulos = boletin.get_modulos_seccion("Adjudicaciones")        
     self.assertEqual(len(modulos), 4)
     self.assertTrue(modulos[0].find("BANCO DE LA NACION ARGENTINA"))
     self.assertTrue(modulos[2].find("BLOQUE2"))
Example #27
0
 def test_when_boletin_doesnt_has_seccion_adjudicaciones(self):
     boletin =  Boletin(fixtures.boletines[1].replace("Adjudicaciones", "Preadjudicaciones"));
     self.assertFalse(boletin.tiene_seccion("Adjudicaciones"))
Example #28
0
 def test_when_boletin_has_seccion_servicios(self):
     boletin = Boletin(fixtures.boletines[1])
     self.assertTrue(
         boletin.tiene_seccion("Servicios Tres Palabras Audiovisuales"))
Example #29
0
 def test_when_boletin_has_seccion_locaciones(self):
     boletin =  Boletin(fixtures.boletines[1]);
     self.assertTrue(boletin.tiene_seccion("Locaciones INMUEBLES \(LOC\)"))
Example #30
0
 def test_when_boletin_has_seccion_locaciones(self):
     boletin = Boletin(fixtures.boletines[1])
     self.assertTrue(boletin.tiene_seccion("Locaciones INMUEBLES \(LOC\)"))
Example #31
0
 def test_when_boletin_returns_modulos_seccion_servicios(self):
     boletin = Boletin(fixtures.boletines[1])
     modulos = boletin.get_modulos_seccion("Servicios Tres Palabras Audiovisuales")
     self.assertEqual(len(modulos), 2)
Example #32
0
    def test_when_boletin_return_seccion_dictamenes_de_evaluacion(self):
        boletin = Boletin(fixtures.boletines[1]);
        self.assertEqual(boletin.get_seccion("Dictámenes de Evaluación"), """
BANCO DE LA NACION ARGENTINA
BANCO PIRULO
""")
Example #33
0
 def test_when_boletin_returns_modulos_seccion_dictameneS(self):
     boletin = Boletin(fixtures.boletines[1])
     modulos = boletin.get_modulos_seccion("Dictámenes de Evaluación")
     self.assertEqual(len(modulos), 1)
Example #34
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
Example #35
0
 def test_when_boletin_returns_modulos_seccion_servicios(self):
     boletin = Boletin(fixtures.boletines[1])
     modulos = boletin.get_modulos_seccion(
         "Servicios Tres Palabras Audiovisuales")
     self.assertEqual(len(modulos), 2)
Example #36
0
 def test_when_boletin_has_seccion_adjudicaciones2(self):
     boletin = Boletin(fixtures.boletines[3])
     self.assertTrue(boletin.tiene_seccion("Adjudicaciones"))
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
Example #38
0
 def test_when_boletin_has_seccion_adjudicaciones2(self):
     boletin =  Boletin(fixtures.boletines[3]);
     self.assertTrue(boletin.tiene_seccion("Adjudicaciones"))