Robotframework Calculator
Introduction
Extension for Robotframework converting Time, Percent, DataPacket into numeric like objects
Allow following math operations
Operating
Math operation:
- Compare - eq, ne, gt, ge, lt, le (Equality allow deviation in percent)
- Add
- Subscript
- Multiple
- Divide
Data formats:
- TimeInterval - 2h 34m, ...
- Percent - 234 + 20%
- DataPacket (support iperf) - 1G, 2g, 45m
- Numeric (integer, float)
Keywords:
Math
LIST_SUM - Allow sumarise provided list of numbers
NUMERIC_OPERATION - Allow regular ariphmetic, logical, percent operation on numbers (in, float)
PACKET_OPERATION - Allow regular ariphmetic, logical, percent operation on DataPacket
TIME_OPERATION - Allow regular ariphmetic, logical, percent operation on TimeIntervals
Look full help in ROBOT_MATH.html
Conversion
GET_PACKET - Convert packet string (1M) into numeric object
GET_TIME_INTERVAL - Convert time string (1h) into numeric object
API:
Data Packet
from robot_math import DataPacket
data_packet1 = DataPacket('1M')
print(f"{data_paket1}")
> 1M
print(f"{data_paket1:K}")
> 1000000K
print(f"{data_paket1:b}")
> 800000000b
data_paket1 += '0.5M'
print(f"{data_paket1}")
> 1.5M
Time Interval
from robot_math import TimeInterval
t1 = TimeInterval('1h')
print(f"{t1}")
> 1h
t1 += '20m'
print(f"{t1}")
> 1h 20m
t1 += TimeInterval('20m')
print(f"{t1}")
> 1h 40m
Percent
from robot_math import Percent
p = Percent('10.5%')
print(f"{p}")
> 10.50%
print(f"{p:.1%}")
> 10.5%
print(f"{p:.3f}")
> 0.105
Installation
PIP
python -m pip install robotframework-calculator
Release files for robotframework-calculator 2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| robotframework_calculator-2.3-py3-none-any.whl | Python 3 | none | any | Details |
Release files / robotframework_calculator-2.3-py3-none-any.whl
| Download URL | robotframework_calculator-2.3-py3-none-any.whl |
|---|---|
| Size | 160.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94734515cf95332dbfc8562c64764831cf7255cd666931a429bcaac2a678c30c
|
|
BLAKE2b-256 checksum How to use checksums |
02facf8e0774aa4a22f2d2e7747cd6009e05912501eaf7da9fc89bc0f9d8bca7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.7.2
|