No project description provided
Project description
Derivation
Derivation is a flexible payload generating framework with highly-customizable patterns and rules which raise your efficiency significantly on test case implementation against complicated inputs.
Getting Started
Derivative
Derivative is the primary object which sorted out all of valid outputs meet the constraints.
The script below can be executed directly
from enum import Enum, auto
from operator import or_
from derivation.constraint import (
MutuallyExclusiveConstraint,
OccurrenceConstraint,
PrerequisiteConstraint,
TerminationConstraint,
)
from derivation.derivative import Derivative
class DerivativeEvent(Enum):
@staticmethod
def _generate_next_value_(name, start, count, last_values):
return name.upper()
class DerivativeEventAlpha(DerivativeEvent):
ESSENTIALS = auto()
OPTIONAL_1 = auto()
OPTIONAL_1_1 = auto()
OPTIONAL_1_2 = auto()
OPTIONAL_2 = auto()
OPTIONAL_3 = auto()
EVENT_ALPHA = {event: {event.value: None} for event in DerivativeEventAlpha}
derivative = Derivative(
EVENT_ALPHA,
or_,
(
OccurrenceConstraint(
(DerivativeEventAlpha.ESSENTIALS,),
min_times=1,
max_times=1,
),
MutuallyExclusiveConstraint(
(
DerivativeEventAlpha.OPTIONAL_1,
DerivativeEventAlpha.OPTIONAL_2,
DerivativeEventAlpha.OPTIONAL_3,
),
),
MutuallyExclusiveConstraint(
(DerivativeEventAlpha.OPTIONAL_1_1, DerivativeEventAlpha.OPTIONAL_1_2),
),
PrerequisiteConstraint(
(DerivativeEventAlpha.OPTIONAL_1,),
(DerivativeEventAlpha.OPTIONAL_1_1, DerivativeEventAlpha.OPTIONAL_1_2),
),
TerminationConstraint(
{
DerivativeEventAlpha.OPTIONAL_1_1,
DerivativeEventAlpha.OPTIONAL_1_2,
DerivativeEventAlpha.OPTIONAL_2,
DerivativeEventAlpha.OPTIONAL_3,
},
),
),
)
for order, result in derivative.exhaustive():
print(f"{order}\n{result}\n")
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
derivation-0.2.0.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for derivation-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2cb4f106f3062a6eb0d4c24cd335b00760107304f7d19b06b07ae9c85d6c0a06 |
|
MD5 | 0368f9626616ee429956e819cf6322c2 |
|
BLAKE2b-256 | 9ae8b897a22dff93d1d461d6d84e85ba73c241350aedd0da21afdef426f42125 |