Skip to main content

Extension for Robotframework converting data packet, time str and percent into numeric objects

Project description

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

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotframework_calculator-2.3-py3-none-any.whl (160.2 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_calculator-2.3-py3-none-any.whl.

File metadata

  • Download URL: robotframework_calculator-2.3-py3-none-any.whl
  • Upload date:
  • Size: 160.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for robotframework_calculator-2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 94734515cf95332dbfc8562c64764831cf7255cd666931a429bcaac2a678c30c
MD5 ade8539b59e4140002818f8925832e5d
BLAKE2b-256 02facf8e0774aa4a22f2d2e7747cd6009e05912501eaf7da9fc89bc0f9d8bca7

See more details on using hashes here.

Supported by

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