aplicacion-ventas-beto 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aplicacion_ventas/__init__.py +0 -0
- aplicacion_ventas/descuentos.py +10 -0
- aplicacion_ventas/exceptions.py +5 -0
- aplicacion_ventas/gestor_ventas.py +17 -0
- aplicacion_ventas/impuestos.py +11 -0
- aplicacion_ventas/precios.py +4 -0
- aplicacion_ventas_beto-0.1.1.dist-info/LICENCE +7 -0
- aplicacion_ventas_beto-0.1.1.dist-info/METADATA +21 -0
- aplicacion_ventas_beto-0.1.1.dist-info/RECORD +13 -0
- aplicacion_ventas_beto-0.1.1.dist-info/WHEEL +5 -0
- aplicacion_ventas_beto-0.1.1.dist-info/top_level.txt +2 -0
- tests/__init__.py +0 -0
- tests/test_aplicacion_ventas.py +21 -0
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from .exceptions import DescuentoInvalidoError
|
|
2
|
+
|
|
3
|
+
class Descuentos:
|
|
4
|
+
def __init__(self, porcentaje):
|
|
5
|
+
if not (0<= porcentaje <= 1):
|
|
6
|
+
raise DescuentoInvalidoError("Porcentaje debe ser entre 0 y 1")
|
|
7
|
+
self.porcentaje = porcentaje
|
|
8
|
+
|
|
9
|
+
def aplicar_descuentos(self,precio):
|
|
10
|
+
return precio * self.porcentaje
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from .descuentos import Descuentos
|
|
2
|
+
from .impuestos import Impuestos
|
|
3
|
+
from .precios import Precios
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class GestorVentas:
|
|
7
|
+
def __init__(self, precio_base, impuesto_porcentaje, descuento_porcentaje):
|
|
8
|
+
self.precio_base = precio_base
|
|
9
|
+
self.impuesto = Impuestos(impuesto_porcentaje)
|
|
10
|
+
self.descuento = Descuentos(descuento_porcentaje)
|
|
11
|
+
|
|
12
|
+
def calcular_precio_final(self):
|
|
13
|
+
impuesto_aplicado = self.impuesto.aplicar_impuesto(self.precio_base)
|
|
14
|
+
descuento_aplicado = self.descuento.aplicar_descuentos(self.precio_base)
|
|
15
|
+
precio_final = Precios.calcular_precio_final(self.precio_base, impuesto_aplicado, descuento_aplicado)
|
|
16
|
+
|
|
17
|
+
return round(precio_final, 2)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
from .exceptions import ImpuestoInvalidoError
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class Impuestos:
|
|
5
|
+
def __init__(self, porcentaje):
|
|
6
|
+
if not (0 <= porcentaje <= 1):
|
|
7
|
+
raise ImpuestoInvalidoError("Tasa de impuesto entre 0 y 1")
|
|
8
|
+
self.porcentaje = porcentaje
|
|
9
|
+
|
|
10
|
+
def aplicar_impuesto(self, precio):
|
|
11
|
+
return precio * self.porcentaje
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: aplicacion-ventas-beto
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: Aplicacion de ventas, impuestos y descuentos
|
|
5
|
+
Home-page: https://github.com/usuario/gestor_ventas
|
|
6
|
+
Author: Beto
|
|
7
|
+
Author-email: albermontesbre@gmail.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.6
|
|
12
|
+
License-File: LICENCE
|
|
13
|
+
|
|
14
|
+
# Aplicacion de ventas
|
|
15
|
+
|
|
16
|
+
Este paquete proporciona funcionalidades para gestionar ventas, incluyendo, cálculo de precios, impuestos y descuentos
|
|
17
|
+
|
|
18
|
+
## Instalacion
|
|
19
|
+
|
|
20
|
+
Puedes instalar el paquete usando:
|
|
21
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
aplicacion_ventas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
aplicacion_ventas/descuentos.py,sha256=ckX5nlSrwCoaCtG3-7jP9116u9TqGMxpoETXttqSzTg,343
|
|
3
|
+
aplicacion_ventas/exceptions.py,sha256=bVw220GICNMvD7z9aLdbOXcOxC8qimk-7jZ1mCUJlo0,103
|
|
4
|
+
aplicacion_ventas/gestor_ventas.py,sha256=ZzH7LjUkfccN5GUSuSb41s3BSfS9CadVNP9hlbDWdbs,711
|
|
5
|
+
aplicacion_ventas/impuestos.py,sha256=Sbsm-sGKMinBXhAM5_l1orkE4mtLi9I-zN2ACWwkBCw,345
|
|
6
|
+
aplicacion_ventas/precios.py,sha256=h5gWh2RDyP7rFSKAdXd-ywf5evk4WewYOAanqSUITpI,149
|
|
7
|
+
tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
tests/test_aplicacion_ventas.py,sha256=OCzOT9TVcJAtxdyl4j8b_WYPQfVSPKAM15JJUpWVA_s,720
|
|
9
|
+
aplicacion_ventas_beto-0.1.1.dist-info/LICENCE,sha256=duKOUtzOgCRyWIyjd6KBxoZouZb0EQwpESRg9wCbmpY,250
|
|
10
|
+
aplicacion_ventas_beto-0.1.1.dist-info/METADATA,sha256=cDAOOCh--VswEEZY52lk285JAQPKP2dtyNT6ioEoBco,636
|
|
11
|
+
aplicacion_ventas_beto-0.1.1.dist-info/WHEEL,sha256=hPN0AlP2dZM_3ZJZWP4WooepkmU9wzjGgCLCeFjkHLA,92
|
|
12
|
+
aplicacion_ventas_beto-0.1.1.dist-info/top_level.txt,sha256=e68vDMUd0q6tO18ZL6CxZSvXsWFGh3xXNwO4KUgPHvI,24
|
|
13
|
+
aplicacion_ventas_beto-0.1.1.dist-info/RECORD,,
|
tests/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import unittest
|
|
2
|
+
from aplicacion_ventas.aplicacion_ventas.gestor_ventas import GestorVentas
|
|
3
|
+
from aplicacion_ventas.aplicacion_ventas.exceptions import ImpuestoInvalidoError, DescuentoInvalidoError
|
|
4
|
+
|
|
5
|
+
class TestGestorVentas(unittest.TestCase):
|
|
6
|
+
|
|
7
|
+
def test_calculo_precio_final(self):
|
|
8
|
+
gestor=GestorVentas(100,0.05,0.1)
|
|
9
|
+
self.assertEqual(gestor.calcular_precio_final(),95.0)
|
|
10
|
+
|
|
11
|
+
def test_impuesto_invalido(self):
|
|
12
|
+
with self.assertRaises(ImpuestoInvalidoError):
|
|
13
|
+
GestorVentas(100,1.5,0.1)
|
|
14
|
+
|
|
15
|
+
def test_descuento_invalido(self):
|
|
16
|
+
with self.assertRaises(DescuentoInvalidoError):
|
|
17
|
+
GestorVentas(100,0.5,1.5)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if __name__ == '__main__':
|
|
21
|
+
unittest.main()
|