Skip to main content

Classe para formatar valores para o formato de Real Brasileiro

Project description

Real brasileiro

Status do projeto: Em desenvolvimento

este projeto tem como objetivo me ajudar na formatação, sanitização e apresentação dos valores com os quais eu diariamente trabalho.

Download

$pip install real-brasileiro==0.0.2

Entradas

from real_br import Real

print(Real(10.10),
    Real(10),
    Real('R$ 100,55'))

Nos testes você consegue conferir melhor em quais formatos a classe aceita os valores.

Criando objeto

from real_br import Real

valor = 10
real = Real(valor)
print(real)

você também pode obter o equivalente em centavos usando

from real_br import Real

valor = 10
real = Real(valor)
print(real.centavos)

A classe retorna float, str e int (int é retornado em centavos)

from real_br import Real

valor = 10
real = Real(valor)
print(float(real),  int(real), str(real))
<<<<<<< HEAD
=======

A classe possui 100% de cobertura de testes

pytest -cov

origin/main

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

real_brasileiro-0.1.1.tar.gz (3.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page