diff --git a/EXAMPLES/loosely_coupled/a/a.json b/EXAMPLES/loosely_coupled/a/a.json new file mode 100644 index 0000000..b39286f --- /dev/null +++ b/EXAMPLES/loosely_coupled/a/a.json @@ -0,0 +1,6 @@ +{ + "subclasses": { + "aa": "loosely_coupled/a/aa/aa.json", + "ab": "loosely_coupled/a/ab/ab.json" + } +} \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/a/a.py b/EXAMPLES/loosely_coupled/a/a.py new file mode 100644 index 0000000..9579924 --- /dev/null +++ b/EXAMPLES/loosely_coupled/a/a.py @@ -0,0 +1,51 @@ +from py4cli.maximal import cnf_parser + +try: + from .aa.aa import AA + from .ab.ab import AB +except: + from aa.aa import AA + from ab.ab import AB + +class A(cnf_parser): + + # Path of files aa & ab to be passed in as arguments + def subclasses(self, aa:str, ab:str): + """ + a.yml: + + subclasses: + aa: aa.yml + ab: ab.yml + + a.json: + + { + "subclasses": { + "aa": "aa.json", + "ab": "ab.json" + } + } + + cmds: + 1. python <__file__> a.yml + 2. python <__file__> a.json + """ + results = {} + results["ret_aa"] = AA(aa).returned + results["ret_ab"] = AB(ab).returned + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = A() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/a/a.yml b/EXAMPLES/loosely_coupled/a/a.yml new file mode 100644 index 0000000..08e26b4 --- /dev/null +++ b/EXAMPLES/loosely_coupled/a/a.yml @@ -0,0 +1,4 @@ + +subclasses: + aa: loosely_coupled/a/aa/aa.yml + ab: loosely_coupled/a/ab/ab.yml \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/a/aa/aa.json b/EXAMPLES/loosely_coupled/a/aa/aa.json new file mode 100644 index 0000000..6de428c --- /dev/null +++ b/EXAMPLES/loosely_coupled/a/aa/aa.json @@ -0,0 +1,24 @@ +{ + "sub_func": { + "aaa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } +} \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/a/aa/aa.py b/EXAMPLES/loosely_coupled/a/aa/aa.py new file mode 100644 index 0000000..01fc297 --- /dev/null +++ b/EXAMPLES/loosely_coupled/a/aa/aa.py @@ -0,0 +1,66 @@ +from py4cli.maximal import cnf_parser + +class AA(cnf_parser): + + # params aaa, aab, aac, aad to be passed in as arguments + def sub_func(self, aaa:dict, aab:dict, aac:dict, aad:dict): + """ + aa.yml: + + sub_func: + aaa: { "k1": "v1", "k2": "v2", "k3": "v3" } + aab: { "k1": "v1", "k2": "v2", "k3": "v3" } + aac: { "k1": "v1", "k2": "v2", "k3": "v3" } + aad: { "k1": "v1", "k2": "v2", "k3": "v3" } + + aa.json: + + { + "subfunc": { + "aaa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + + cmds: + 1. python <__file__> aa.yml + 2. python <__file__> aa.json + """ + results = {} + results["ret_aaa"] = aaa + results["ret_aab"] = aab + results["ret_aac"] = aac + results["ret_aad"] = aad + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = AA() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/a/aa/aa.yml b/EXAMPLES/loosely_coupled/a/aa/aa.yml new file mode 100644 index 0000000..517b166 --- /dev/null +++ b/EXAMPLES/loosely_coupled/a/aa/aa.yml @@ -0,0 +1,5 @@ +sub_func: + aaa: { "k1": "v1", "k2": "v2", "k3": "v3" } + aab: { "k1": "v1", "k2": "v2", "k3": "v3" } + aac: { "k1": "v1", "k2": "v2", "k3": "v3" } + aad: { "k1": "v1", "k2": "v2", "k3": "v3" } diff --git a/EXAMPLES/loosely_coupled/a/ab/ab.json b/EXAMPLES/loosely_coupled/a/ab/ab.json new file mode 100644 index 0000000..9cc0e8c --- /dev/null +++ b/EXAMPLES/loosely_coupled/a/ab/ab.json @@ -0,0 +1,24 @@ +{ + "sub_func": { + "aba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } +} \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/a/ab/ab.py b/EXAMPLES/loosely_coupled/a/ab/ab.py new file mode 100644 index 0000000..d311031 --- /dev/null +++ b/EXAMPLES/loosely_coupled/a/ab/ab.py @@ -0,0 +1,66 @@ +from py4cli.maximal import cnf_parser + +class AB(cnf_parser): + + # params aba, abb, abc, abd to be passed in as arguments + def sub_func(self, aba:dict, abb:dict, abc:dict, abd:dict): + """ + ab.yml: + + sub_func: + aba: { "k1": "v1", "k2": "v2", "k3": "v3" } + abb: { "k1": "v1", "k2": "v2", "k3": "v3" } + abc: { "k1": "v1", "k2": "v2", "k3": "v3" } + abd: { "k1": "v1", "k2": "v2", "k3": "v3" } + + ab.json: + + { + "subfunc": { + "aba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + + cmds: + 1. python <__file__> ab.yml + 2. python <__file__> ab.json + """ + results = {} + results["ret_aba"] = aba + results["ret_abb"] = abb + results["ret_abc"] = abc + results["ret_abd"] = abd + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = AB() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/a/ab/ab.yml b/EXAMPLES/loosely_coupled/a/ab/ab.yml new file mode 100644 index 0000000..673d0c5 --- /dev/null +++ b/EXAMPLES/loosely_coupled/a/ab/ab.yml @@ -0,0 +1,5 @@ +sub_func: + aba: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + abb: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + abc: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + abd: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/b/b.json b/EXAMPLES/loosely_coupled/b/b.json new file mode 100644 index 0000000..316d9c2 --- /dev/null +++ b/EXAMPLES/loosely_coupled/b/b.json @@ -0,0 +1,6 @@ +{ + "subclasses": { + "ba": "loosely_coupled/b/ba/ba.json", + "bb": "loosely_coupled/b/bb/bb.json" + } +} \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/b/b.py b/EXAMPLES/loosely_coupled/b/b.py new file mode 100644 index 0000000..ab04bd4 --- /dev/null +++ b/EXAMPLES/loosely_coupled/b/b.py @@ -0,0 +1,51 @@ +from py4cli.maximal import cnf_parser + +try: + from .ba.ba import BA + from .bb.bb import BB +except: + from ba.ba import BA + from bb.bb import BB + +class B(cnf_parser): + + # Path of files ba & bb to be passed in as arguments + def subclasses(self, ba:str, bb:str): + """ + b.yml: + + subclasses: + ba: ba.yml + bb: bb.yml + + b.json: + + { + "subclasses": { + "ba": "ba.json", + "bb": "bb.json" + } + } + + cmds: + 1. python <__file__> b.yml + 2. python <__file__> b.json + """ + results = {} + results["ret_ba"] = BA(ba).returned + results["ret_bb"] = BB(bb).returned + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = B() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/b/b.yml b/EXAMPLES/loosely_coupled/b/b.yml new file mode 100644 index 0000000..c2420c9 --- /dev/null +++ b/EXAMPLES/loosely_coupled/b/b.yml @@ -0,0 +1,4 @@ + +subclasses: + ba: loosely_coupled/b/ba/ba.yml + bb: loosely_coupled/b/bb/bb.yml \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/b/ba/ba.json b/EXAMPLES/loosely_coupled/b/ba/ba.json new file mode 100644 index 0000000..ac9dc9d --- /dev/null +++ b/EXAMPLES/loosely_coupled/b/ba/ba.json @@ -0,0 +1,24 @@ +{ + "sub_func": { + "baa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } +} \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/b/ba/ba.py b/EXAMPLES/loosely_coupled/b/ba/ba.py new file mode 100644 index 0000000..7afb9e0 --- /dev/null +++ b/EXAMPLES/loosely_coupled/b/ba/ba.py @@ -0,0 +1,66 @@ +from py4cli.maximal import cnf_parser + +class BA(cnf_parser): + + # params baa, bab, bac, bad to be passed in as arguments + def sub_func(self, baa:dict, bab:dict, bac:dict, bad:dict): + """ + ba.yml: + + sub_func: + baa: { "k1": "v1", "k2": "v2", "k3": "v3" } + bab: { "k1": "v1", "k2": "v2", "k3": "v3" } + bac: { "k1": "v1", "k2": "v2", "k3": "v3" } + bad: { "k1": "v1", "k2": "v2", "k3": "v3" } + + ba.json: + + { + "subfunc": { + "baa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + + cmds: + 1. python <__file__> ba.yml + 2. python <__file__> bb.json + """ + results = {} + results["ret_baa"] = baa + results["ret_bab"] = bab + results["ret_bac"] = bac + results["ret_bad"] = bad + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = BA() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/b/ba/ba.yml b/EXAMPLES/loosely_coupled/b/ba/ba.yml new file mode 100644 index 0000000..0f0d141 --- /dev/null +++ b/EXAMPLES/loosely_coupled/b/ba/ba.yml @@ -0,0 +1,5 @@ +sub_func: + baa: { "k1": "v1", "k2": "v2", "k3": "v3" } + bab: { "k1": "v1", "k2": "v2", "k3": "v3" } + bac: { "k1": "v1", "k2": "v2", "k3": "v3" } + bad: { "k1": "v1", "k2": "v2", "k3": "v3" } diff --git a/EXAMPLES/loosely_coupled/b/bb/bb.json b/EXAMPLES/loosely_coupled/b/bb/bb.json new file mode 100644 index 0000000..74afc2f --- /dev/null +++ b/EXAMPLES/loosely_coupled/b/bb/bb.json @@ -0,0 +1,24 @@ +{ + "sub_func": { + "bba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } +} \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/b/bb/bb.py b/EXAMPLES/loosely_coupled/b/bb/bb.py new file mode 100644 index 0000000..57e5826 --- /dev/null +++ b/EXAMPLES/loosely_coupled/b/bb/bb.py @@ -0,0 +1,66 @@ +from py4cli.maximal import cnf_parser + +class BB(cnf_parser): + + # params bba, bbb, bbc, bbd to be passed in as arguments + def sub_func(self, bba:dict, bbb:dict, bbc:dict, bbd:dict): + """ + bb.yml: + + sub_func: + bba: { "k1": "v1", "k2": "v2", "k3": "v3" } + bbb: { "k1": "v1", "k2": "v2", "k3": "v3" } + bbc: { "k1": "v1", "k2": "v2", "k3": "v3" } + bbd: { "k1": "v1", "k2": "v2", "k3": "v3" } + + bb.json: + + { + "subfunc": { + "bba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + + cmds: + 1. python <__file__> bb.yml + 2. python <__file__> bb.json + """ + results = {} + results["ret_bba"] = bba + results["ret_bbb"] = bbb + results["ret_bbc"] = bbc + results["ret_bbd"] = bbd + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = BB() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/b/bb/bb.yml b/EXAMPLES/loosely_coupled/b/bb/bb.yml new file mode 100644 index 0000000..c59b55d --- /dev/null +++ b/EXAMPLES/loosely_coupled/b/bb/bb.yml @@ -0,0 +1,5 @@ +sub_func: + bba: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + bbb: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + bbc: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + bbd: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/demo.json b/EXAMPLES/loosely_coupled/demo.json new file mode 100644 index 0000000..3f6a15e --- /dev/null +++ b/EXAMPLES/loosely_coupled/demo.json @@ -0,0 +1,6 @@ +{ + "classes": { + "a": "loosely_coupled/a/a.json", + "b": "loosely_coupled/b/b.json" + } +} \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/demo.py b/EXAMPLES/loosely_coupled/demo.py new file mode 100644 index 0000000..69e7346 --- /dev/null +++ b/EXAMPLES/loosely_coupled/demo.py @@ -0,0 +1,48 @@ + +from py4cli.maximal import cnf_parser + +from a.a import A +from b.b import B + +class demo(cnf_parser): + + # Path of files a & b to be passed in as arguments + def classes(self, a:str, b:str): + """ + demo.yml: + + classes: + a: a.yml + b: b.yml + + demo.json: + + { + "classes": { + "a": "a.json", + "b": "b.json" + } + } + + cmds: + 1. python <__file__> demo.yml + 2. python <__file__> demo.json + """ + results = {} + results["ret_a"] = A(a).returned + results["ret_b"] = B(b).returned + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = demo() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/EXAMPLES/loosely_coupled/demo.yml b/EXAMPLES/loosely_coupled/demo.yml new file mode 100644 index 0000000..0890add --- /dev/null +++ b/EXAMPLES/loosely_coupled/demo.yml @@ -0,0 +1,3 @@ +classes: + a: loosely_coupled/a/a.yml + b: loosely_coupled/b/b.yml \ No newline at end of file diff --git a/EXAMPLES/use_max.json b/EXAMPLES/use_max.json new file mode 100644 index 0000000..a490e81 --- /dev/null +++ b/EXAMPLES/use_max.json @@ -0,0 +1,128 @@ +{ + "multi_args7": { + "inp_int": 100, + "inp_float": 100.00, + "inp_str": "Hello from JSON, to multi_args7", + "inp_list": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "inp_dict": { + "Hello": "World", + "from": "JSON" + }, + "inp_bool": true + }, + "multi_args6": { + "inp_int": 100, + "inp_float": 100.00, + "inp_str": "Hello from JSON, to multi_args6", + "inp_list": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "inp_dict": { + "Hello": "World", + "from": "JSON" + }, + "inp_bool": true + }, + "multi_args5": { + "inp_int": 100, + "inp_float": 100.00, + "inp_str": "Hello from JSON, to multi_args5", + "inp_list": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "inp_dict": { + "Hello": "World", + "from": "JSON" + }, + "inp_bool": true + }, + "multi_args4": { + "inp_int": 100, + "inp_float": 100.00, + "inp_str": "Hello from JSON, to multi_args4", + "inp_list": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "inp_dict": { + "Hello": "World", + "from": "JSON" + }, + "inp_bool": true + }, + "multi_args3": { + "inp_int": 100, + "inp_float": 100.00, + "inp_str": "Hello from JSON, to multi_args3", + "inp_list": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "inp_dict": { + "Hello": "World", + "from": "JSON" + }, + "inp_bool": true + }, + "multi_args2": { + "inp_int": 100, + "inp_float": 100.00, + "inp_str": "Hello from JSON, to multi_args2", + "inp_list": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "inp_dict": { + "Hello": "World", + "from": "JSON" + }, + "inp_bool": true + }, + "multi_args1": { + "inp_int": 100, + "inp_float": 100.00, + "inp_str": "Hello from JSON, to multi_args1", + "inp_list": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "inp_dict": { + "Hello": "World", + "from": "JSON" + }, + "inp_bool": true + } +} \ No newline at end of file diff --git a/EXAMPLES/use_max.yml b/EXAMPLES/use_max.yml new file mode 100644 index 0000000..85abb6b --- /dev/null +++ b/EXAMPLES/use_max.yml @@ -0,0 +1,49 @@ +multi_args7: + inp_int: 100 + inp_float: 100.00 + inp_str: "Hello from YML, to multi_args7" + inp_list: [1, 2, 3, 4, 5, 6] + inp_dict: { "Hello": "World", "from": "YML" } + inp_bool: True +multi_args6: + inp_int: 100 + inp_float: 100.00 + inp_str: "Hello from YML, to multi_args6" + inp_list: [1, 2, 3, 4, 5, 6] + inp_dict: { "Hello": "World", "from": "YML" } + inp_bool: True +multi_args5: + inp_int: 100 + inp_float: 100.00 + inp_str: "Hello from YML, to multi_args5" + inp_list: [1, 2, 3, 4, 5, 6] + inp_dict: { "Hello": "World", "from": "YML" } + inp_bool: True +multi_args4: + inp_int: 100 + inp_float: 100.00 + inp_str: "Hello from YML, to multi_args4" + inp_list: [1, 2, 3, 4, 5, 6] + inp_dict: { "Hello": "World", "from": "YML" } + inp_bool: True +multi_args3: + inp_int: 100 + inp_float: 100.00 + inp_str: "Hello from YML, to multi_args3" + inp_list: [1, 2, 3, 4, 5, 6] + inp_dict: { "Hello": "World", "from": "YML" } + inp_bool: True +multi_args2: + inp_int: 100 + inp_float: 100.00 + inp_str: "Hello from YML, to multi_args2" + inp_list: [1, 2, 3, 4, 5, 6] + inp_dict: { "Hello": "World", "from": "YML" } + inp_bool: True +multi_args1: + inp_int: 100 + inp_float: 100.00 + inp_str: "Hello from YML, to multi_args1" + inp_list: [1, 2, 3, 4, 5, 6] + inp_dict: { "Hello": "World", "from": "YML" } + inp_bool: True diff --git a/EXAMPLES/use_maximal.py b/EXAMPLES/use_maximal.py new file mode 100644 index 0000000..79ea8a2 --- /dev/null +++ b/EXAMPLES/use_maximal.py @@ -0,0 +1,174 @@ + +from py4cli.maximal import cnf_parser + +# Multiple arguments example + +class vscaled_args(cnf_parser): + + # example multi_args template function with multiple arguments of different types + def multi_args1(self, + inp_int: int = 6, + inp_float: float = 6.0, + inp_str: str = "Six", + inp_list: list = [6, 6.0, "Six"], + inp_dict: dict = {'int': 6, 'float': 6.0, 'str': "Six"}, + inp_bool: bool = False) -> dict: + """ + Six arguments of different data type can be passed + any value of the respective data type can be passed for specific argument. for defaults refer above + the function returns a dict containing all the arguments and its values. + """ + return { + 'inp_int': inp_int, + 'inp_float': inp_float, + 'inp_str': inp_str, + 'inp_list': inp_list, + 'inp_dict': inp_dict, + 'inp_bool': inp_bool + } + + # example multi_args template function with multiple arguments of different types + def multi_args2(self, + inp_int: int = 6, + inp_float: float = 6.0, + inp_str: str = "Six", + inp_list: list = [6, 6.0, "Six"], + inp_dict: dict = {'int': 6, 'float': 6.0, 'str': "Six"}, + inp_bool: bool = False) -> dict: + """ + Six arguments of different data type can be passed + any value of the respective data type can be passed for specific argument. for defaults refer above + the function returns a dict containing all the arguments and its values. + """ + return { + 'inp_int': inp_int, + 'inp_float': inp_float, + 'inp_str': inp_str, + 'inp_list': inp_list, + 'inp_dict': inp_dict, + 'inp_bool': inp_bool + } + + # example multi_args template function with multiple arguments of different types + def multi_args3(self, + inp_int: int = 6, + inp_float: float = 6.0, + inp_str: str = "Six", + inp_list: list = [6, 6.0, "Six"], + inp_dict: dict = {'int': 6, 'float': 6.0, 'str': "Six"}, + inp_bool: bool = False) -> dict: + """ + Six arguments of different data type can be passed + any value of the respective data type can be passed for specific argument. for defaults refer above + the function returns a dict containing all the arguments and its values. + """ + return { + 'inp_int': inp_int, + 'inp_float': inp_float, + 'inp_str': inp_str, + 'inp_list': inp_list, + 'inp_dict': inp_dict, + 'inp_bool': inp_bool + } + + # example multi_args template function with multiple arguments of different types + def multi_args4(self, + inp_int: int = 6, + inp_float: float = 6.0, + inp_str: str = "Six", + inp_list: list = [6, 6.0, "Six"], + inp_dict: dict = {'int': 6, 'float': 6.0, 'str': "Six"}, + inp_bool: bool = False) -> dict: + """ + Six arguments of different data type can be passed + any value of the respective data type can be passed for specific argument. for defaults refer above + the function returns a dict containing all the arguments and its values. + """ + return { + 'inp_int': inp_int, + 'inp_float': inp_float, + 'inp_str': inp_str, + 'inp_list': inp_list, + 'inp_dict': inp_dict, + 'inp_bool': inp_bool + } + + # example multi_args template function with multiple arguments of different types + def multi_args5(self, + inp_int: int = 6, + inp_float: float = 6.0, + inp_str: str = "Six", + inp_list: list = [6, 6.0, "Six"], + inp_dict: dict = {'int': 6, 'float': 6.0, 'str': "Six"}, + inp_bool: bool = False) -> dict: + """ + Six arguments of different data type can be passed + any value of the respective data type can be passed for specific argument. for defaults refer above + the function returns a dict containing all the arguments and its values. + """ + return { + 'inp_int': inp_int, + 'inp_float': inp_float, + 'inp_str': inp_str, + 'inp_list': inp_list, + 'inp_dict': inp_dict, + 'inp_bool': inp_bool + } + + # example multi_args template function with multiple arguments of different types + def multi_args6(self, + inp_int: int = 6, + inp_float: float = 6.0, + inp_str: str = "Six", + inp_list: list = [6, 6.0, "Six"], + inp_dict: dict = {'int': 6, 'float': 6.0, 'str': "Six"}, + inp_bool: bool = False) -> dict: + """ + Six arguments of different data type can be passed + any value of the respective data type can be passed for specific argument. for defaults refer above + the function returns a dict containing all the arguments and its values. + """ + return { + 'inp_int': inp_int, + 'inp_float': inp_float, + 'inp_str': inp_str, + 'inp_list': inp_list, + 'inp_dict': inp_dict, + 'inp_bool': inp_bool + } + + # example multi_args template function with multiple arguments of different types + def multi_args7(self, + inp_int: int = 6, + inp_float: float = 6.0, + inp_str: str = "Six", + inp_list: list = [6, 6.0, "Six"], + inp_dict: dict = {'int': 6, 'float': 6.0, 'str': "Six"}, + inp_bool: bool = False) -> dict: + """ + Six arguments of different data type can be passed + any value of the respective data type can be passed for specific argument. for defaults refer above + the function returns a dict containing all the arguments and its values. + """ + return { + 'inp_int': inp_int, + 'inp_float': inp_float, + 'inp_str': inp_str, + 'inp_list': inp_list, + 'inp_dict': inp_dict, + 'inp_bool': inp_bool + } + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = vscaled_args() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/EXAMPLES/use_moderate.py b/EXAMPLES/use_moderate.py index 08618da..412f062 100644 --- a/EXAMPLES/use_moderate.py +++ b/EXAMPLES/use_moderate.py @@ -203,6 +203,6 @@ def multi_args7(self, print("") if obj.returned: out_dict = obj.returned.copy() - print(json.dumps(out_dict, indent=2, sort_keys=True), type(obj.returned)) + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) else: print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/README.md b/README.md index 8b7f7e1..8e0b91a 100644 --- a/README.md +++ b/README.md @@ -95,8 +95,8 @@ if __name__ == '__main__': | the function returns a dict containing all the arguments and its values. | | cmds : - | 1. python D:\GitRepos\py4cli\EXAMPLES\use_minimal.py 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True - | 2. python D:\GitRepos\py4cli\EXAMPLES\use_minimal.py -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True + | 1. python D:\GitRepos\py4cli\EXAMPLES\use_minimal.py 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True + | 2. python D:\GitRepos\py4cli\EXAMPLES\use_minimal.py -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True | | -> dict (Returnable) @@ -319,8 +319,8 @@ None | the function returns a dict containing all the arguments and its values. | | cmds : - | 1. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args1 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True - | 2. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args1 -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True + | 1. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args1 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True + | 2. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args1 -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True | | -> dict (Returnable) @@ -346,8 +346,8 @@ None | the function returns a dict containing all the arguments and its values. | | cmds : - | 1. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args2 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True - | 2. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args2 -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True + | 1. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args2 10 10.0 "Seven" "[10, 10.0, 'Seven']" "{'int':10, 'float':10.0, 'str':'Seven'}" True + | 2. python D:\GitRepos\py4cli\EXAMPLES\use_moderate.py ~multi_args2 -inp_int=10 -inp_float=10.0 -inp_str="Seven" -inp_list="[10, 10.0, 'Seven']" -inp_dict="{'int':10, 'float':10.0, 'str':'Seven'}" -inp_bool=True | | -> dict (Returnable) @@ -406,9 +406,184 @@ output ``` -## Maximal (in progress) +## Maximal - Horizontally scalable version of minimal arg parser, aimed at use case like, workflow development for testing & debug needs. +- Sample code as shown below can read yml or json file configurations in specified type as per function signature. (refer **use_maximal.py** under **EXAMPLES/**) + +```python +from py4cli.maximal import cnf_parser + +# Multiple arguments example + +class vscaled_args(cnf_parser): + + # example multi_args template function with multiple arguments of different types + def multi_args1(self, + inp_int: int = 6, + inp_float: float = 6.0, + inp_str: str = "Six", + inp_list: list = [6, 6.0, "Six"], + inp_dict: dict = {'int': 6, 'float': 6.0, 'str': "Six"}, + inp_bool: bool = False) -> dict: + """ + Six arguments of different data type can be passed + any value of the respective data type can be passed for specific argument. for defaults refer above + the function returns a dict containing all the arguments and its values. + """ + return { + 'inp_int': inp_int, + 'inp_float': inp_float, + 'inp_str': inp_str, + 'inp_list': inp_list, + 'inp_dict': inp_dict, + 'inp_bool': inp_bool + } + + # example multi_args template function with multiple arguments of different types + def multi_args2(self, + inp_int: int = 6, + inp_float: float = 6.0, + inp_str: str = "Six", + inp_list: list = [6, 6.0, "Six"], + inp_dict: dict = {'int': 6, 'float': 6.0, 'str': "Six"}, + inp_bool: bool = False) -> dict: + """ + Six arguments of different data type can be passed + any value of the respective data type can be passed for specific argument. for defaults refer above + the function returns a dict containing all the arguments and its values. + """ + return { + 'inp_int': inp_int, + 'inp_float': inp_float, + 'inp_str': inp_str, + 'inp_list': inp_list, + 'inp_dict': inp_dict, + 'inp_bool': inp_bool + } + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = vscaled_args() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) + +``` + +- To get help on how to use the script, execute **python use_maximal.py -h** or **python use_maximal.py --help** which will generate the doc content based on the comments in script as shown below. + +```output + +(examples) D:\GitRepos\py4cli\EXAMPLES>python use_maximal.py --help +['use_maximal.py', '--help'] +class : vscaled_args + + | > def multi_args1 + | + | Description : + | + | example multi_args template function with multiple arguments of different types + | + | Arguments : + | + | -inp_int: int = 6 + | -inp_float: float = 6.0 + | -inp_str: str = 'Six' + | -inp_list: list = [6, 6.0, 'Six'] + | -inp_dict: dict = {'int': 6, 'float': 6.0, 'str': 'Six'} + | -inp_bool: bool = False + | + | Usage : + | + | Six arguments of different data type can be passed + | any value of the respective data type can be passed for specific argument. for defaults refer above + | the function returns a dict containing all the arguments and its values. + | + | -> dict (Returnable) + + | > def multi_args2 + | + | Description : + | + | example multi_args template function with multiple arguments of different types + | + | Arguments : + | + | -inp_int: int = 6 + | -inp_float: float = 6.0 + | -inp_str: str = 'Six' + | -inp_list: list = [6, 6.0, 'Six'] + | -inp_dict: dict = {'int': 6, 'float': 6.0, 'str': 'Six'} + | -inp_bool: bool = False + | + | Usage : + | + | Six arguments of different data type can be passed + | any value of the respective data type can be passed for specific argument. for defaults refer above + | the function returns a dict containing all the arguments and its values. + | + | -> dict (Returnable) + +OrderedDict() + +``` + +- The commands specified can be used to alter the values as yml or json file to the script. The methods can be selected with appropriate arguments as per definition, and the order of execution of the methods is also controllable. For illustration purpose only two methods [multi_args1, multi_args2] is defined which can be scaled to number of functions, as much as python supports. + +``` +output + +(py4cli) D:\GitRepos\py4cli\EXAMPLES>python use_maximal.py use_max.yml +['use_maximal.py', 'use_max.yml'] + +{ + "multi_args1": { + "inp_int": 100, + "inp_float": 100.0, + "inp_str": "Hello from YML, to multi_args1", + "inp_list": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "inp_dict": { + "Hello": "World", + "from": "YML" + }, + "inp_bool": true + }, + "multi_args2": { + "inp_int": 100, + "inp_float": 100.0, + "inp_str": "Hello from YML, to multi_args2", + "inp_list": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "inp_dict": { + "Hello": "World", + "from": "YML" + }, + "inp_bool": true + } +} + +``` ## supported in windows & linux : diff --git a/REPORTS/TestCaseResults.html b/REPORTS/TestCaseResults.html index e1c24d6..e9607a3 100644 --- a/REPORTS/TestCaseResults.html +++ b/REPORTS/TestCaseResults.html @@ -3,7 +3,596 @@
Test Report

Summary

127
127 passed

Tests

TESTS/test_min_call.py 38 0:00:00.073520

PASSED test_single_int[arg0-None] 0:00:00.006668

Setup

Call

Captured stdout call

+    
Test Report

Summary

153
153 passed

Tests

TESTS/test_max_call.py 17 0:00:00.097396

PASSED test_demo_args[arg0-ret0] 0:00:00.000743

Setup

Call

Captured stdout call

+['demo.py'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_demo_args[arg1-ret1] 0:00:00.004199

Setup

Call

Captured stdout call
class : demo
+
+ | > def classes 
+ |    
+ |  Description :
+ |    
+ |    Path of files a & b to be passed in as arguments  
+ |    
+ |  Arguments :
+ |    
+ |   -a: str
+ |   -b: str
+ |    
+ |  Usage :
+ |    
+ |    python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py demo.yml or python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py demo.json  
+ |    
+ | -> Any (Returnable)
+
+ | > def err_on_df 
+ |    
+ |  Arguments :
+ |    
+ |   -df: pandas.core.frame.DataFrame
+ |    
+ | -> Any (Returnable)
+
+['demo.py', '-h'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_demo_args[arg2-ret2] 0:00:00.004267

Setup

Call

Captured stdout call
class : demo
+
+ | > def classes 
+ |    
+ |  Description :
+ |    
+ |    Path of files a & b to be passed in as arguments  
+ |    
+ |  Arguments :
+ |    
+ |   -a: str
+ |   -b: str
+ |    
+ |  Usage :
+ |    
+ |    python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py demo.yml or python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py demo.json  
+ |    
+ | -> Any (Returnable)
+
+ | > def err_on_df 
+ |    
+ |  Arguments :
+ |    
+ |   -df: pandas.core.frame.DataFrame
+ |    
+ | -> Any (Returnable)
+
+['demo.py', '--help'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_demo_args[arg3-ret3] 0:00:00.041001

Setup

Call

Captured stdout call
WARNING : 'sub_func' returns '<class 'dict'>', but defined to return 'None'
+WARNING : 'sub_func' returns '<class 'dict'>', but defined to return 'None'
+
+['demo.py', 'maximal_scripts/demo.yml'] : Expected(OrderedDict([('classes', {'ret_a': {'subclasses': {'ret_aa': {'sub_func': {'ret_aaa': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aab': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aac': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aad': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}}}, 'ret_ab': {'sub_func': {'ret_aba': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abb': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abc': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abd': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}}}}}, 'ret_b': {'subclasses': {'ret_ba': {'sub_func': {'ret_baa': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bab': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bac': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bad': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}}}, 'ret_bb': {'sub_func': {'ret_bba': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbb': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbc': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbd': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}}}}}})])) == Actual(OrderedDict([('classes', {'ret_a': OrderedDict([('subclasses', {'ret_aa': OrderedDict([('sub_func', {'ret_aaa': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aab': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aac': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aad': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}})]), 'ret_ab': OrderedDict([('sub_func', {'ret_aba': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abb': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abc': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abd': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}})])})]), 'ret_b': OrderedDict([('subclasses', {'ret_ba': OrderedDict([('sub_func', {'ret_baa': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bab': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bac': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bad': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}})]), 'ret_bb': OrderedDict([('sub_func', {'ret_bba': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbb': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbc': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbd': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}})])})])})]))
+
+

Teardown

PASSED test_demo_args[arg4-ret4] 0:00:00.017130

Setup

Call

Captured stdout call
WARNING : 'sub_func' returns '<class 'dict'>', but defined to return 'None'
+WARNING : 'sub_func' returns '<class 'dict'>', but defined to return 'None'
+
+['demo.py', 'maximal_scripts/demo.json'] : Expected(OrderedDict([('classes', {'ret_a': {'subclasses': {'ret_aa': {'sub_func': {'ret_aaa': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aab': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aac': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aad': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}}}, 'ret_ab': {'sub_func': {'ret_aba': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abb': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abc': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abd': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}}}}}, 'ret_b': {'subclasses': {'ret_ba': {'sub_func': {'ret_baa': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bab': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bac': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bad': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}}}, 'ret_bb': {'sub_func': {'ret_bba': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbb': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbc': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbd': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}}}}}})])) == Actual(OrderedDict([('classes', {'ret_a': OrderedDict([('subclasses', {'ret_aa': OrderedDict([('sub_func', {'ret_aaa': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aab': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aac': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_aad': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}})]), 'ret_ab': OrderedDict([('sub_func', {'ret_aba': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abb': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abc': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_abd': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}})])})]), 'ret_b': OrderedDict([('subclasses', {'ret_ba': OrderedDict([('sub_func', {'ret_baa': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bab': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bac': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bad': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}})]), 'ret_bb': OrderedDict([('sub_func', {'ret_bba': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbb': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbc': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}, 'ret_bbd': {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'}})])})])})]))
+
+

Teardown

PASSED test_aa_args[arg0-ret0] 0:00:00.000645

Setup

Call

Captured stdout call

+['demo.py'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_aa_args[arg1-ret1] 0:00:00.004225

Setup

Call

Captured stdout call
class : AA
+
+ | > def sub_func 
+ |    
+ |  Description :
+ |    
+ |    params aaa, aab, aac, aad to be passed in as arguments  
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning  
+ |    
+ |  Arguments :
+ |    
+ |   -aaa: dict
+ |   -aab: dict
+ |   -aac: dict
+ |   -aad: dict = {}
+ |    
+ |  Usage :
+ |    
+ |    aa.yml:  
+ |     
+ |        sub_func: 
+ |            aaa: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            aab: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            aac: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            aad: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |     
+ |    aa.json: 
+ |     
+ |        { 
+ |            "subfunc": { 
+ |                "aaa": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "aab": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "aac": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "aad": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                } 
+ |            } 
+ |        } 
+ |     
+ |    cmds: 
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py aa.yml 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py aa.json  
+ |    
+ | -> dict (Returnable)
+
+['demo.py', '-h'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_aa_args[arg2-ret2] 0:00:00.002612

Setup

Call

Captured stdout call
class : AA
+
+ | > def sub_func 
+ |    
+ |  Description :
+ |    
+ |    params aaa, aab, aac, aad to be passed in as arguments  
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning  
+ |    
+ |  Arguments :
+ |    
+ |   -aaa: dict
+ |   -aab: dict
+ |   -aac: dict
+ |   -aad: dict = {}
+ |    
+ |  Usage :
+ |    
+ |    aa.yml:  
+ |     
+ |        sub_func: 
+ |            aaa: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            aab: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            aac: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            aad: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |     
+ |    aa.json: 
+ |     
+ |        { 
+ |            "subfunc": { 
+ |                "aaa": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "aab": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "aac": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "aad": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                } 
+ |            } 
+ |        } 
+ |     
+ |    cmds: 
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py aa.yml 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py aa.json  
+ |    
+ | -> dict (Returnable)
+
+['demo.py', '--help'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_ab_args[arg0-ret0] 0:00:00.000517

Setup

Call

Captured stdout call

+['demo.py'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_ab_args[arg1-ret1] 0:00:00.004250

Setup

Call

Captured stdout call
class : AB
+
+ | > def sub_func 
+ |    
+ |  Description :
+ |    
+ |    params aba, abb, abc, abd to be passed in as arguments  
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning  
+ |    
+ |  Arguments :
+ |    
+ |   -aba: dict
+ |   -abb: dict
+ |   -abc: dict
+ |   -abd: dict
+ |    
+ |  Usage :
+ |    
+ |    ab.yml:  
+ |     
+ |        sub_func: 
+ |            aba: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            abb: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            abc: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            abd: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |     
+ |    ab.json: 
+ |     
+ |        { 
+ |            "subfunc": { 
+ |                "aba": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "abb": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "abc": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "abd": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                } 
+ |            } 
+ |        } 
+ |     
+ |    cmds: 
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ab.yml 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ab.json  
+ |    
+ | -> dict (Returnable)
+
+['demo.py', '-h'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_ab_args[arg2-ret2] 0:00:00.002657

Setup

Call

Captured stdout call
class : AB
+
+ | > def sub_func 
+ |    
+ |  Description :
+ |    
+ |    params aba, abb, abc, abd to be passed in as arguments  
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning  
+ |    
+ |  Arguments :
+ |    
+ |   -aba: dict
+ |   -abb: dict
+ |   -abc: dict
+ |   -abd: dict
+ |    
+ |  Usage :
+ |    
+ |    ab.yml:  
+ |     
+ |        sub_func: 
+ |            aba: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            abb: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            abc: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            abd: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |     
+ |    ab.json: 
+ |     
+ |        { 
+ |            "subfunc": { 
+ |                "aba": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "abb": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "abc": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "abd": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                } 
+ |            } 
+ |        } 
+ |     
+ |    cmds: 
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ab.yml 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ab.json  
+ |    
+ | -> dict (Returnable)
+
+['demo.py', '--help'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_ba_args[arg0-ret0] 0:00:00.000529

Setup

Call

Captured stdout call

+['demo.py'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_ba_args[arg1-ret1] 0:00:00.004196

Setup

Call

Captured stdout call
class : BA
+
+ | > def sub_func 
+ |    
+ |  Description :
+ |    
+ |    params baa, bab, bac, bad to be passed in as arguments  
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning  
+ |    
+ |  Arguments :
+ |    
+ |   -baa: dict
+ |   -bab: dict
+ |   -bac: dict
+ |   -bad: dict
+ |    
+ |  Usage :
+ |    
+ |    ba.yml:  
+ |     
+ |        sub_func: 
+ |            baa: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bab: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bac: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bad: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |     
+ |    ba.json: 
+ |     
+ |        { 
+ |            "subfunc": { 
+ |                "baa": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bab": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bac": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bad": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                } 
+ |            } 
+ |        } 
+ |     
+ |    cmds: 
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ba.yml 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py bb.json  
+ |    
+ | -> None (Returnable)
+
+['demo.py', '-h'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_ba_args[arg2-ret2] 0:00:00.002766

Setup

Call

Captured stdout call
class : BA
+
+ | > def sub_func 
+ |    
+ |  Description :
+ |    
+ |    params baa, bab, bac, bad to be passed in as arguments  
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning  
+ |    
+ |  Arguments :
+ |    
+ |   -baa: dict
+ |   -bab: dict
+ |   -bac: dict
+ |   -bad: dict
+ |    
+ |  Usage :
+ |    
+ |    ba.yml:  
+ |     
+ |        sub_func: 
+ |            baa: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bab: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bac: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bad: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |     
+ |    ba.json: 
+ |     
+ |        { 
+ |            "subfunc": { 
+ |                "baa": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bab": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bac": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bad": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                } 
+ |            } 
+ |        } 
+ |     
+ |    cmds: 
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ba.yml 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py bb.json  
+ |    
+ | -> None (Returnable)
+
+['demo.py', '--help'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_bb_args[arg0-ret0] 0:00:00.000529

Setup

Call

Captured stdout call

+['demo.py'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_bb_args[arg1-ret1] 0:00:00.004428

Setup

Call

Captured stdout call
class : BB
+
+ | > def sub_func 
+ |    
+ |  Description :
+ |    
+ |    params bba, bbb, bbc, bbd to be passed in as arguments  
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning  
+ |    
+ |  Arguments :
+ |    
+ |   -bba: dict
+ |   -bbb: dict
+ |   -bbc: dict
+ |   -bbd: dict
+ |    
+ |  Usage :
+ |    
+ |    bb.yml:  
+ |     
+ |        sub_func: 
+ |            bba: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bbb: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bbc: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bbd: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |     
+ |    bb.json: 
+ |     
+ |        { 
+ |            "subfunc": { 
+ |                "bba": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bbb": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bbc": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bbd": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                } 
+ |            } 
+ |        } 
+ |     
+ |    cmds: 
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py bb.yml 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py bb.json  
+ |    
+ | -> None (Returnable)
+
+['demo.py', '-h'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

PASSED test_bb_args[arg2-ret2] 0:00:00.002703

Setup

Call

Captured stdout call
class : BB
+
+ | > def sub_func 
+ |    
+ |  Description :
+ |    
+ |    params bba, bbb, bbc, bbd to be passed in as arguments  
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning 
+ |    return type explicitly specified as None, for test coverage of warning  
+ |    
+ |  Arguments :
+ |    
+ |   -bba: dict
+ |   -bbb: dict
+ |   -bbc: dict
+ |   -bbd: dict
+ |    
+ |  Usage :
+ |    
+ |    bb.yml:  
+ |     
+ |        sub_func: 
+ |            bba: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bbb: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bbc: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |            bbd: { "k1": "v1", "k2": "v2", "k3": "v3" } 
+ |     
+ |    bb.json: 
+ |     
+ |        { 
+ |            "subfunc": { 
+ |                "bba": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bbb": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bbc": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                }, 
+ |                "bbd": { 
+ |                    "k1": "v1", 
+ |                    "k2": "v2", 
+ |                    "k3": "v3" 
+ |                } 
+ |            } 
+ |        } 
+ |     
+ |    cmds: 
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py bb.yml 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py bb.json  
+ |    
+ | -> None (Returnable)
+
+['demo.py', '--help'] : Expected(OrderedDict()) == Actual(OrderedDict())
+
+

Teardown

TESTS/test_max_warn.py 9 0:00:00.020157

PASSED test_file_not_found 0:00:00.000641

Setup

Call

Captured stdout call
/mnt/d/GitRepos/py4cli/TESTS/dummy.yml
+

Teardown

PASSED test_empty_yml 0:00:00.001963

Setup

Call

Teardown

PASSED test_none_yml 0:00:00.002612

Setup

Call

Teardown

PASSED test_empty_json 0:00:00.002010

Setup

Call

Captured stdout call
Expecting value: line 1 column 1 (char 0) in /mnt/d/GitRepos/py4cli/TESTS/maximal_scripts/empty.json
+

Teardown

PASSED test_none_json 0:00:00.002093

Setup

Call

Teardown

PASSED test_err_yml 0:00:00.002320

Setup

Call

Teardown

PASSED test_func_err 0:00:00.002874

Setup

Call

Teardown

PASSED test_type_err1 0:00:00.002897

Setup

Call

Teardown

PASSED test_type_err2 0:00:00.002747

Setup

Call

Teardown

TESTS/test_min_call.py 38 0:00:00.039885

PASSED test_single_int[arg0-ret0] 0:00:00.002962

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -21,14 +610,14 @@
  |    the function returns the same arg value as type <int> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10  
  |    
  | -> int (Returnable)
 
-['basic_usage.py', '-h'] : Expected(None) == Actual(None)
+['basic_usage.py', '-h'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_int[arg1-None] 0:00:00.003289

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_int[arg1-ret1] 0:00:00.001921

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -46,23 +635,23 @@
  |    the function returns the same arg value as type <int> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10  
  |    
  | -> int (Returnable)
 
-['basic_usage.py', '--help'] : Expected(None) == Actual(None)
+['basic_usage.py', '--help'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_int[arg2-0] 0:00:00.000748

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_int[arg2-0] 0:00:00.000523

Setup

Call

Captured stdout call

 ['basic_usage.py'] : Expected(0) == Actual(0)
 
-

Teardown

PASSED test_single_int[arg3-10] 0:00:00.000951

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_int[arg3-10] 0:00:00.000636

Setup

Call

Captured stdout call

 ['basic_usage.py', '10'] : Expected(10) == Actual(10)
 
-

Teardown

PASSED test_single_int[arg4-10] 0:00:00.000767

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_int[arg4-10] 0:00:00.000521

Setup

Call

Captured stdout call

 ['basic_usage.py', '-inp_int=10'] : Expected(10) == Actual(10)
 
-

Teardown

PASSED test_single_float[arg0-None] 0:00:00.003401

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_float[arg0-ret0] 0:00:00.001653

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -80,14 +669,14 @@
  |    the function returns the same arg value as type <float> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10.0 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_float=10.0  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10.0 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_float=10.0  
  |    
  | -> float (Returnable)
 
-['basic_usage.py', '-h'] : Expected(None) == Actual(None)
+['basic_usage.py', '-h'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_float[arg1-None] 0:00:00.003330

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_float[arg1-ret1] 0:00:00.001655

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -105,23 +694,23 @@
  |    the function returns the same arg value as type <float> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10.0 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_float=10.0  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10.0 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_float=10.0  
  |    
  | -> float (Returnable)
 
-['basic_usage.py', '--help'] : Expected(None) == Actual(None)
+['basic_usage.py', '--help'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_float[arg2-0.0] 0:00:00.000738

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_float[arg2-0.0] 0:00:00.000502

Setup

Call

Captured stdout call

 ['basic_usage.py'] : Expected(0.0) == Actual(0.0)
 
-

Teardown

PASSED test_single_float[arg3-10.0] 0:00:00.000818

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_float[arg3-10.0] 0:00:00.000512

Setup

Call

Captured stdout call

 ['basic_usage.py', '10.0'] : Expected(10.0) == Actual(10.0)
 
-

Teardown

PASSED test_single_float[arg4-10.0] 0:00:00.000766

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_float[arg4-10.0] 0:00:00.000504

Setup

Call

Captured stdout call

 ['basic_usage.py', '-inp_float=10.0'] : Expected(10.0) == Actual(10.0)
 
-

Teardown

PASSED test_single_str[arg0-None] 0:00:00.003307

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_str[arg0-ret0] 0:00:00.001725

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -139,14 +728,14 @@
  |    the function returns the same arg value as type <str> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py Empty 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_str=Empty  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py Empty 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_str=Empty  
  |    
  | -> str (Returnable)
 
-['basic_usage.py', '-h'] : Expected(None) == Actual(None)
+['basic_usage.py', '-h'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_str[arg1-None] 0:00:00.003322

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_str[arg1-ret1] 0:00:00.001958

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -164,23 +753,23 @@
  |    the function returns the same arg value as type <str> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py Empty 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_str=Empty  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py Empty 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_str=Empty  
  |    
  | -> str (Returnable)
 
-['basic_usage.py', '--help'] : Expected(None) == Actual(None)
+['basic_usage.py', '--help'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_str[arg2-None] 0:00:00.000806

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_str[arg2-None] 0:00:00.000520

Setup

Call

Captured stdout call

 ['basic_usage.py'] : Expected(None) == Actual(None)
 
-

Teardown

PASSED test_single_str[arg3-Empty] 0:00:00.002031

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_str[arg3-Empty] 0:00:00.000490

Setup

Call

Captured stdout call

 ['basic_usage.py', 'Empty'] : Expected(Empty) == Actual(Empty)
 
-

Teardown

PASSED test_single_str[arg4-Empty] 0:00:00.000782

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_str[arg4-Empty] 0:00:00.000520

Setup

Call

Captured stdout call

 ['basic_usage.py', '-inp_str=Empty'] : Expected(Empty) == Actual(Empty)
 
-

Teardown

PASSED test_single_list[arg0-None] 0:00:00.003408

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_list[arg0-ret0] 0:00:00.001724

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -198,14 +787,14 @@
  |    the function returns the same arg value as type <list> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ["Empty"] 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_list=["Empty"]  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ["Empty"] 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_list=["Empty"]  
  |    
  | -> list (Returnable)
 
-['basic_usage.py', '-h'] : Expected(None) == Actual(None)
+['basic_usage.py', '-h'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_list[arg1-None] 0:00:00.003410

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_list[arg1-ret1] 0:00:00.001649

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -223,23 +812,23 @@
  |    the function returns the same arg value as type <list> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ["Empty"] 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_list=["Empty"]  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ["Empty"] 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_list=["Empty"]  
  |    
  | -> list (Returnable)
 
-['basic_usage.py', '--help'] : Expected(None) == Actual(None)
+['basic_usage.py', '--help'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_list[arg2-ret2] 0:00:00.000760

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_list[arg2-ret2] 0:00:00.000505

Setup

Call

Captured stdout call

 ['basic_usage.py'] : Expected([None]) == Actual([None])
 
-

Teardown

PASSED test_single_list[arg3-ret3] 0:00:00.000821

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_list[arg3-ret3] 0:00:00.000563

Setup

Call

Captured stdout call

 ['basic_usage.py', "['Empty']"] : Expected(['Empty']) == Actual(['Empty'])
 
-

Teardown

PASSED test_single_list[arg4-ret4] 0:00:00.000796

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_list[arg4-ret4] 0:00:00.000506

Setup

Call

Captured stdout call

 ['basic_usage.py', "-inp_list=['Empty']"] : Expected(['Empty']) == Actual(['Empty'])
 
-

Teardown

PASSED test_single_dict[arg0-None] 0:00:00.003413

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_dict[arg0-ret0] 0:00:00.001878

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -257,14 +846,14 @@
  |    the function returns the same arg value as type <dict> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py {"Empty":"Empty"} 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_dict={"Empty":"Empty"}  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py {"Empty":"Empty"} 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_dict={"Empty":"Empty"}  
  |    
  | -> dict (Returnable)
 
-['basic_usage.py', '-h'] : Expected(None) == Actual(None)
+['basic_usage.py', '-h'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_dict[arg1-None] 0:00:00.005188

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_dict[arg1-ret1] 0:00:00.001763

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -282,23 +871,23 @@
  |    the function returns the same arg value as type <dict> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py {"Empty":"Empty"} 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_dict={"Empty":"Empty"}  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py {"Empty":"Empty"} 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_dict={"Empty":"Empty"}  
  |    
  | -> dict (Returnable)
 
-['basic_usage.py', '--help'] : Expected(None) == Actual(None)
+['basic_usage.py', '--help'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_dict[arg2-ret2] 0:00:00.000764

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_dict[arg2-ret2] 0:00:00.000517

Setup

Call

Captured stdout call

 ['basic_usage.py'] : Expected({None: None}) == Actual({None: None})
 
-

Teardown

PASSED test_single_dict[arg3-ret3] 0:00:00.000793

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_dict[arg3-ret3] 0:00:00.000524

Setup

Call

Captured stdout call

 ['basic_usage.py', "{'Empty':'Empty'}"] : Expected({'Empty': 'Empty'}) == Actual({'Empty': 'Empty'})
 
-

Teardown

PASSED test_single_dict[arg4-ret4] 0:00:00.000800

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_dict[arg4-ret4] 0:00:00.000503

Setup

Call

Captured stdout call

 ['basic_usage.py', "-inp_dict={'Empty':'Empty'}"] : Expected({'Empty': 'Empty'}) == Actual({'Empty': 'Empty'})
 
-

Teardown

PASSED test_single_bool[arg0-None] 0:00:00.003501

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_bool[arg0-ret0] 0:00:00.001768

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -316,14 +905,14 @@
  |    the function returns the same arg value as type <bool> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_bool=True  
  |    
  | -> bool (Returnable)
 
-['basic_usage.py', '-h'] : Expected(None) == Actual(None)
+['basic_usage.py', '-h'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_bool[arg1-None] 0:00:00.003406

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_bool[arg1-ret1] 0:00:00.001673

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -341,23 +930,23 @@
  |    the function returns the same arg value as type <bool> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_bool=True  
  |    
  | -> bool (Returnable)
 
-['basic_usage.py', '--help'] : Expected(None) == Actual(None)
+['basic_usage.py', '--help'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_single_bool[arg2-False] 0:00:00.000748

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_bool[arg2-False] 0:00:00.000498

Setup

Call

Captured stdout call

 ['basic_usage.py'] : Expected(False) == Actual(False)
 
-

Teardown

PASSED test_single_bool[arg3-True] 0:00:00.000773

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_bool[arg3-True] 0:00:00.000521

Setup

Call

Captured stdout call

 ['basic_usage.py', 'True'] : Expected(True) == Actual(True)
 
-

Teardown

PASSED test_single_bool[arg4-True] 0:00:00.000775

Setup

Call

Captured stdout call

+

Teardown

PASSED test_single_bool[arg4-True] 0:00:00.000516

Setup

Call

Captured stdout call

 ['basic_usage.py', '-inp_bool=True'] : Expected(True) == Actual(True)
 
-

Teardown

PASSED test_multi_args[arg0-None] 0:00:00.003713

Setup

Call

Captured stdout call

+

Teardown

PASSED test_multi_args[arg0-ret0] 0:00:00.001755

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -380,14 +969,14 @@
  |    the function returns a dict containing all the arguments and its values. 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True  
  |    
  | -> dict (Returnable)
 
-['basic_usage.py', '-h'] : Expected(None) == Actual(None)
+['basic_usage.py', '-h'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_multi_args[arg1-None] 0:00:00.003406

Setup

Call

Captured stdout call

+

Teardown

PASSED test_multi_args[arg1-ret1] 0:00:00.001909

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -410,32 +999,32 @@
  |    the function returns a dict containing all the arguments and its values. 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True  
  |    
  | -> dict (Returnable)
 
-['basic_usage.py', '--help'] : Expected(None) == Actual(None)
+['basic_usage.py', '--help'] : Expected({}) == Actual({})
 
-

Teardown

PASSED test_multi_args[arg2-ret2] 0:00:00.000824

Setup

Call

Captured stdout call

+

Teardown

PASSED test_multi_args[arg2-ret2] 0:00:00.000579

Setup

Call

Captured stdout call

 ['basic_usage.py'] : Expected({'inp_int': 6, 'inp_float': 6.0, 'inp_str': 'Six', 'inp_list': [6, 6.0, 'Six'], 'inp_dict': {'int': 6, 'float': 6.0, 'str': 'Six'}, 'inp_bool': False}) == Actual({'inp_int': 6, 'inp_float': 6.0, 'inp_str': 'Six', 'inp_list': [6, 6.0, 'Six'], 'inp_dict': {'int': 6, 'float': 6.0, 'str': 'Six'}, 'inp_bool': False})
 
-

Teardown

PASSED test_multi_args[arg3-ret3] 0:00:00.000803

Setup

Call

Captured stdout call

+

Teardown

PASSED test_multi_args[arg3-ret3] 0:00:00.000948

Setup

Call

Captured stdout call

 ['basic_usage.py', '10', '10.0', 'Seven'] : Expected({'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [6, 6.0, 'Six'], 'inp_dict': {'int': 6, 'float': 6.0, 'str': 'Six'}, 'inp_bool': False}) == Actual({'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [6, 6.0, 'Six'], 'inp_dict': {'int': 6, 'float': 6.0, 'str': 'Six'}, 'inp_bool': False})
 
-

Teardown

PASSED test_multi_args[arg4-ret4] 0:00:00.000833

Setup

Call

Captured stdout call

+

Teardown

PASSED test_multi_args[arg4-ret4] 0:00:00.000706

Setup

Call

Captured stdout call

 ['basic_usage.py', '10', '10.0', 'Seven', "-inp_dict={'int':10,'float':10.0,'str':'Seven'}"] : Expected({'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [6, 6.0, 'Six'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': False}) == Actual({'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [6, 6.0, 'Six'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': False})
 
-

Teardown

PASSED test_multi_args[arg5-ret5] 0:00:00.000905

Setup

Call

Captured stdout call

+

Teardown

PASSED test_multi_args[arg5-ret5] 0:00:00.000657

Setup

Call

Captured stdout call

 ['basic_usage.py', "-inp_dict={'int':10,'float':10.0,'str':'Seven'}"] : Expected({'inp_int': 6, 'inp_float': 6.0, 'inp_str': 'Six', 'inp_list': [6, 6.0, 'Six'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': False}) == Actual({'inp_int': 6, 'inp_float': 6.0, 'inp_str': 'Six', 'inp_list': [6, 6.0, 'Six'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': False})
 
-

Teardown

PASSED test_multi_args[arg6-ret6] 0:00:00.001057

Setup

Call

Captured stdout call

+

Teardown

PASSED test_multi_args[arg6-ret6] 0:00:00.000644

Setup

Call

Captured stdout call

 ['basic_usage.py', '10', '10.0', 'Seven', "[10,10.0,'Seven']", "{'int':10,'float':10.0,'str':'Seven'}", 'True'] : Expected({'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [10, 10.0, 'Seven'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': True}) == Actual({'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [10, 10.0, 'Seven'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': True})
 
-

Teardown

PASSED test_multi_args[arg7-ret7] 0:00:00.000897

Setup

Call

Captured stdout call

+

Teardown

PASSED test_multi_args[arg7-ret7] 0:00:00.000977

Setup

Call

Captured stdout call

 ['basic_usage.py', '-inp_int=10', '-inp_float=10.0', '-inp_str=Seven', "-inp_list=[10,10.0,'Seven']", "-inp_dict={'int':10,'float':10.0,'str':'Seven'}", '-inp_bool=True'] : Expected({'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [10, 10.0, 'Seven'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': True}) == Actual({'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [10, 10.0, 'Seven'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': True})
 
-

Teardown

TESTS/test_min_os.py 38 0:00:31.770886

PASSED test_os_calls[python minimal_scripts/use_int.py -h-min_int_h.txt] 0:00:00.718171

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_int.py --help-min_int_help.txt] 0:00:00.673823

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_int.py-min_int.txt] 0:00:00.697181

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_int.py 10-min_int_args.txt] 0:00:00.828516

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_int.py -inp_int=10-min_int_kwargs.txt] 0:00:00.704561

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py -h-min_float_h.txt] 0:00:00.781426

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py --help-min_float_help.txt] 0:00:00.809488

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py-min_float.txt] 0:00:00.844143

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py 10.0-min_float_args.txt] 0:00:00.775775

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py -inp_float=10.0-min_float_kwargs.txt] 0:00:00.817634

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py -h-min_str_h.txt] 0:00:00.751263

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py --help-min_str_help.txt] 0:00:00.890272

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py-min_str.txt] 0:00:00.865942

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py hello-min_str_args.txt] 0:00:00.812593

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py -inp_str=hello-min_str_kwargs.txt] 0:00:00.822566

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py -h-min_list_h.txt] 0:00:00.883466

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py --help-min_list_help.txt] 0:00:00.943678

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py-min_list.txt] 0:00:00.975723

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py [1,2,3]-min_list_args.txt] 0:00:01.158216

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py -inp_list=[1,2,3]-min_list_kwargs.txt] 0:00:00.940692

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py -h-min_dict_h.txt] 0:00:00.817126

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py --help-min_dict_help.txt] 0:00:00.799473

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py-min_dict.txt] 0:00:00.853915

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py "{'hello':'world'}"-min_dict_args.txt] 0:00:00.698268

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py -inp_dict="{'hello':'world'}"-min_dict_kwargs.txt] 0:00:00.884288

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py -h-min_bool_h.txt] 0:00:00.943673

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py --help-min_bool_help.txt] 0:00:00.949394

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py-min_bool.txt] 0:00:01.154121

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py True-min_bool_args.txt] 0:00:00.867102

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py -inp_bool=True-min_bool_kwargs.txt] 0:00:00.690922

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py -h-min_multi_h.txt] 0:00:00.878709

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py --help-min_multi_help.txt] 0:00:00.685013

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py-min_multi.txt] 0:00:00.755028

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py 10 10.0 Seven "[10,10.0,'Seven']" "{'int':10,'float':10.0,'str':'Seven'}" True-min_multi_args.txt] 0:00:00.690887

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list="[10,10.0,'Seven']" -inp_dict="{'int':10,'float':10.0,'str':'Seven'}" -inp_bool=True-min_multi_kwargs.txt] 0:00:00.772676

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py 10 10.0 Seven-min_multi_mix1.txt] 0:00:00.822581

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py 10 10.0 Seven -inp_dict="{'int':10,'float':10.0,'str':'Seven'}"-min_multi_mix2.txt] 0:00:00.878602

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py -inp_dict="{'int':10,'float':10.0,'str':'Seven'}"-min_multi_mix3.txt] 0:00:00.933977

Setup

Call

Teardown

TESTS/test_min_warn.py 11 0:00:00.024688

PASSED test_warn_ret_type1 0:00:00.002813

Setup

Call

Captured stdout call

+

Teardown

TESTS/test_min_os.py 38 0:00:28.962261

PASSED test_os_calls[python minimal_scripts/use_int.py -h-min_int_h.txt] 0:00:00.477121

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_int.py --help-min_int_help.txt] 0:00:00.449317

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_int.py-min_int.txt] 0:00:00.569372

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_int.py 10-min_int_args.txt] 0:00:00.438893

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_int.py -inp_int=10-min_int_kwargs.txt] 0:00:00.930954

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py -h-min_float_h.txt] 0:00:00.911507

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py --help-min_float_help.txt] 0:00:00.444462

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py-min_float.txt] 0:00:00.490499

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py 10.0-min_float_args.txt] 0:00:00.778979

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_float.py -inp_float=10.0-min_float_kwargs.txt] 0:00:00.724211

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py -h-min_str_h.txt] 0:00:00.917756

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py --help-min_str_help.txt] 0:00:00.915138

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py-min_str.txt] 0:00:00.831031

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py hello-min_str_args.txt] 0:00:00.598889

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_str.py -inp_str=hello-min_str_kwargs.txt] 0:00:00.867239

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py -h-min_list_h.txt] 0:00:00.935277

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py --help-min_list_help.txt] 0:00:00.723549

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py-min_list.txt] 0:00:00.904079

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py [1,2,3]-min_list_args.txt] 0:00:00.535794

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_list.py -inp_list=[1,2,3]-min_list_kwargs.txt] 0:00:01.040611

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py -h-min_dict_h.txt] 0:00:00.613821

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py --help-min_dict_help.txt] 0:00:00.950003

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py-min_dict.txt] 0:00:00.906590

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py "{'hello':'world'}"-min_dict_args.txt] 0:00:00.915124

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_dict.py -inp_dict="{'hello':'world'}"-min_dict_kwargs.txt] 0:00:00.602545

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py -h-min_bool_h.txt] 0:00:01.362881

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py --help-min_bool_help.txt] 0:00:00.593431

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py-min_bool.txt] 0:00:00.846773

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py True-min_bool_args.txt] 0:00:00.823989

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/use_bool.py -inp_bool=True-min_bool_kwargs.txt] 0:00:00.854070

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py -h-min_multi_h.txt] 0:00:00.460635

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py --help-min_multi_help.txt] 0:00:01.431033

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py-min_multi.txt] 0:00:00.463471

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py 10 10.0 Seven "[10,10.0,'Seven']" "{'int':10,'float':10.0,'str':'Seven'}" True-min_multi_args.txt] 0:00:00.673466

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list="[10,10.0,'Seven']" -inp_dict="{'int':10,'float':10.0,'str':'Seven'}" -inp_bool=True-min_multi_kwargs.txt] 0:00:00.991198

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py 10 10.0 Seven-min_multi_mix1.txt] 0:00:00.805010

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py 10 10.0 Seven -inp_dict="{'int':10,'float':10.0,'str':'Seven'}"-min_multi_mix2.txt] 0:00:00.728550

Setup

Call

Teardown

PASSED test_os_calls[python minimal_scripts/multi_args.py -inp_dict="{'int':10,'float':10.0,'str':'Seven'}"-min_multi_mix3.txt] 0:00:00.454992

Setup

Call

Teardown

TESTS/test_min_warn.py 11 0:00:00.012755

PASSED test_warn_ret_type1 0:00:00.002719

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -455,14 +1044,14 @@
  |    the function returns the same arg value as type <int> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py 10 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_int=10  
  |    
  | -> str (Returnable)
-None
-

Teardown

PASSED test_warn_ret_type2 0:00:00.001149

Setup

Call

Captured stdout call
0
-

Teardown

PASSED test_warn_ret_type3 0:00:00.001201

Setup

Call

Captured stdout call
Expected '<class 'int'>' value for 'inp_int' in kwargs of method 'parse_args', got '50.456' instead
-

Teardown

PASSED test_warn_wo_ret_typ_def1 0:00:00.005028

Setup

Call

Captured stdout call

+{}
+

Teardown

PASSED test_warn_ret_type2 0:00:00.000783

Setup

Call

Captured stdout call
0
+

Teardown

PASSED test_warn_ret_type3 0:00:00.000629

Setup

Call

Captured stdout call
Expected '<class 'int'>' value for 'inp_int' in kwargs of method 'parse_args', got '50.456' instead
+

Teardown

PASSED test_warn_wo_ret_typ_def1 0:00:00.002452

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -480,13 +1069,13 @@
  |    the function returns the same arg value 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py -inp_bool=True  
  |    
  | -> Any (Returnable)
-None
-

Teardown

PASSED test_warn_wo_ret_typ_def2 0:00:00.000640

Setup

Call

Captured stdout call
None
-

Teardown

PASSED test_warn_no_support_typ_arg1 0:00:00.005302

Setup

Call

Captured stdout call

+{}
+

Teardown

PASSED test_warn_wo_ret_typ_def2 0:00:00.000552

Setup

Call

Captured stdout call
None
+

Teardown

PASSED test_warn_no_support_typ_arg1 0:00:00.002013

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -502,9 +1091,9 @@
  |    example defined for checking if exception is getting raised, will not return any output as the definition is not valid  
  |    
  | -> None (Returnable)
-None
-

Teardown

PASSED test_warn_no_support_typ_arg2 0:00:00.001087

Setup

Call

Captured stdout call
Unsupported argument data type : '<class 'pandas.core.frame.DataFrame'>', try using basic types (int, float, str, list, dict, bool) instead
-

Teardown

PASSED test_warn_on_arg_order1 0:00:00.005180

Setup

Call

Captured stdout call

+{}
+

Teardown

PASSED test_warn_no_support_typ_arg2 0:00:00.000379

Setup

Call

Captured stdout call
Unsupported argument data type : '<class 'pandas.core.frame.DataFrame'>', try using basic types (int, float, str, list, dict, bool) instead
+

Teardown

PASSED test_warn_on_arg_order1 0:00:00.001801

Setup

Call

Captured stdout call

  | > def parse_args 
  |    
  |  Description :
@@ -521,11 +1110,11 @@
  |    example defined for checking if exception is getting raised, in scenarios where arguments order is changed.  
  |    
  | -> tuple (Returnable)
-None
-

Teardown

PASSED test_warn_on_arg_order2 0:00:00.000942

Setup

Call

Captured stdout call
positional argument follows keyword argument 'inp_bool1'
-

Teardown

PASSED test_warn_on_arg_order3 0:00:00.000631

Setup

Call

Captured stdout call
Expected '<class 'bool'>' value for 'inp_bool1' in kwargs of method 'parse_args', got 'hello' instead
-

Teardown

PASSED test_warn_on_undef_parse_args 0:00:00.000715

Setup

Call

Captured stdout call
func name : 'parse_args' is not defined
-

Teardown

TESTS/test_mod_call.py 6 0:00:00.081052

PASSED test_vscaled_args[arg0-None] 0:00:00.000939

Setup

Call

Captured stdout call
Methods available for use, is listed below
+{}
+

Teardown

PASSED test_warn_on_arg_order2 0:00:00.000546

Setup

Call

Captured stdout call
positional argument follows keyword argument 'inp_bool1'
+

Teardown

PASSED test_warn_on_arg_order3 0:00:00.000419

Setup

Call

Captured stdout call
Expected '<class 'bool'>' value for 'inp_bool1' in kwargs of method 'parse_args', got 'hello' instead
+

Teardown

PASSED test_warn_on_undef_parse_args 0:00:00.000463

Setup

Call

Captured stdout call
func name : 'parse_args' is not defined
+

Teardown

TESTS/test_mod_call.py 6 0:00:00.051207

PASSED test_vscaled_args[arg0-ret0] 0:00:00.000616

Setup

Call

Captured stdout call
Methods available for use, is listed below
 [
   "~multi_args",
   "~single_bool",
@@ -540,9 +1129,9 @@
   "~warn_wo_ret_typ_def"
 ]
 
-['basic_usgae.py'] : Expected(None) == Actual(None)
+['basic_usage.py'] : Expected(OrderedDict()) == Actual(OrderedDict())
 
-

Teardown

PASSED test_vscaled_args[arg1-None] 0:00:00.053623

Setup

Call

Captured stdout call

+

Teardown

PASSED test_vscaled_args[arg1-ret1] 0:00:00.016209

Setup

Call

Captured stdout call

  | > def multi_args 
  |    
  |  Description :
@@ -565,8 +1154,8 @@
  |    the function returns a dict containing all the arguments and its values. 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~multi_args 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~multi_args 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True  
  |    
  | -> dict (Returnable)
 
@@ -587,8 +1176,8 @@
  |    the function returns the same arg value as type <bool> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_bool True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_bool -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_bool True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_bool -inp_bool=True  
  |    
  | -> bool (Returnable)
 
@@ -609,8 +1198,8 @@
  |    the function returns the same arg value as type <dict> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_dict {'Empty':'Empty'} 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_dict -inp_dict={'Empty':'Empty'}  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_dict {'Empty':'Empty'} 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_dict -inp_dict={'Empty':'Empty'}  
  |    
  | -> dict (Returnable)
 
@@ -631,8 +1220,8 @@
  |    the function returns the same arg value as type <float> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_float 10.0 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_float -inp_float=10.0  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_float 10.0 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_float -inp_float=10.0  
  |    
  | -> float (Returnable)
 
@@ -653,8 +1242,8 @@
  |    the function returns the same arg value as type <int> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_int 10 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_int -inp_int=10  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_int 10 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_int -inp_int=10  
  |    
  | -> int (Returnable)
 
@@ -675,8 +1264,8 @@
  |    the function returns the same arg value as type <list> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_list ['Empty'] 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_list -inp_list=['Empty']  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_list ['Empty'] 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_list -inp_list=['Empty']  
  |    
  | -> list (Returnable)
 
@@ -697,8 +1286,8 @@
  |    the function returns the same arg value as type <str> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_str "Empty" 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_str -inp_str="Empty"  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_str "Empty" 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_str -inp_str="Empty"  
  |    
  | -> str (Returnable)
 
@@ -754,8 +1343,8 @@
  |    the function returns the same arg value as type <int> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_ret_type 10 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_ret_type -inp_int=10  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_ret_type 10 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_ret_type -inp_int=10  
  |    
  | -> str (Returnable)
 
@@ -776,14 +1365,14 @@
  |    the function returns the same arg value 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_wo_ret_typ_def True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_wo_ret_typ_def -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_wo_ret_typ_def True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_wo_ret_typ_def -inp_bool=True  
  |    
  | -> Any (Returnable)
 
-['basic_usage.py', '-h'] : Expected(None) == Actual(None)
+['basic_usage.py', '-h'] : Expected(OrderedDict()) == Actual(OrderedDict())
 
-

Teardown

PASSED test_vscaled_args[arg2-None] 0:00:00.023263

Setup

Call

Captured stdout call

+

Teardown

PASSED test_vscaled_args[arg2-ret2] 0:00:00.032222

Setup

Call

Captured stdout call

  | > def multi_args 
  |    
  |  Description :
@@ -806,8 +1395,8 @@
  |    the function returns a dict containing all the arguments and its values. 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~multi_args 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~multi_args 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True  
  |    
  | -> dict (Returnable)
 
@@ -828,8 +1417,8 @@
  |    the function returns the same arg value as type <bool> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_bool True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_bool -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_bool True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_bool -inp_bool=True  
  |    
  | -> bool (Returnable)
 
@@ -850,8 +1439,8 @@
  |    the function returns the same arg value as type <dict> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_dict {'Empty':'Empty'} 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_dict -inp_dict={'Empty':'Empty'}  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_dict {'Empty':'Empty'} 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_dict -inp_dict={'Empty':'Empty'}  
  |    
  | -> dict (Returnable)
 
@@ -872,8 +1461,8 @@
  |    the function returns the same arg value as type <float> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_float 10.0 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_float -inp_float=10.0  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_float 10.0 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_float -inp_float=10.0  
  |    
  | -> float (Returnable)
 
@@ -894,8 +1483,8 @@
  |    the function returns the same arg value as type <int> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_int 10 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_int -inp_int=10  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_int 10 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_int -inp_int=10  
  |    
  | -> int (Returnable)
 
@@ -916,8 +1505,8 @@
  |    the function returns the same arg value as type <list> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_list ['Empty'] 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_list -inp_list=['Empty']  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_list ['Empty'] 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_list -inp_list=['Empty']  
  |    
  | -> list (Returnable)
 
@@ -938,8 +1527,8 @@
  |    the function returns the same arg value as type <str> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_str "Empty" 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_str -inp_str="Empty"  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_str "Empty" 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~single_str -inp_str="Empty"  
  |    
  | -> str (Returnable)
 
@@ -995,8 +1584,8 @@
  |    the function returns the same arg value as type <int> 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_ret_type 10 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_ret_type -inp_int=10  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_ret_type 10 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_ret_type -inp_int=10  
  |    
  | -> str (Returnable)
 
@@ -1017,27 +1606,27 @@
  |    the function returns the same arg value 
  |     
  |    cmds : 
- |    1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_wo_ret_typ_def True 
- |    2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_wo_ret_typ_def -inp_bool=True  
+ |        1. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_wo_ret_typ_def True 
+ |        2. python /home/palani-sn/miniconda3/envs/py4cli/lib/python3.7/site-packages/pytest/__main__.py ~warn_wo_ret_typ_def -inp_bool=True  
  |    
  | -> Any (Returnable)
 
-['basic_usage.py', '--help'] : Expected(None) == Actual(None)
+['basic_usage.py', '--help'] : Expected(OrderedDict()) == Actual(OrderedDict())
 
-

Teardown

PASSED test_vscaled_args[arg3-ret3] 0:00:00.001099

Setup

Call

Captured stdout call

-['basic_usage.py', '~single_bool', 'True', '~single_dict', "{'Empty':'Empty'}", '~single_float', '10.0', '~single_int', '10', '~single_list', "['Empty']", '~single_str', 'Empty'] : Expected({'single_bool': True, 'single_dict': {'Empty': 'Empty'}, 'single_float': 10.0, 'single_int': 10, 'single_list': ['Empty'], 'single_str': 'Empty'}) == Actual({'single_bool': True, 'single_dict': {'Empty': 'Empty'}, 'single_float': 10.0, 'single_int': 10, 'single_list': ['Empty'], 'single_str': 'Empty'})
+

Teardown

PASSED test_vscaled_args[arg3-ret3] 0:00:00.000809

Setup

Call

Captured stdout call

+['basic_usage.py', '~single_bool', 'True', '~single_dict', "{'Empty':'Empty'}", '~single_float', '10.0', '~single_int', '10', '~single_list', "['Empty']", '~single_str', 'Empty'] : Expected({'single_bool': True, 'single_dict': {'Empty': 'Empty'}, 'single_float': 10.0, 'single_int': 10, 'single_list': ['Empty'], 'single_str': 'Empty'}) == Actual(OrderedDict([('single_bool', True), ('single_dict', {'Empty': 'Empty'}), ('single_float', 10.0), ('single_int', 10), ('single_list', ['Empty']), ('single_str', 'Empty')]))
 
-

Teardown

PASSED test_vscaled_args[arg4-ret4] 0:00:00.001073

Setup

Call

Captured stdout call

-['basic_usage.py', '~single_bool', '-inp_bool=True', '~single_dict', "-inp_dict={'Empty':'Empty'}", '~single_float', '-inp_float=10.0', '~single_int', '-inp_int=10', '~single_list', "-inp_list=['Empty']", '~single_str', '-inp_str=Empty'] : Expected({'single_bool': True, 'single_dict': {'Empty': 'Empty'}, 'single_float': 10.0, 'single_int': 10, 'single_list': ['Empty'], 'single_str': 'Empty'}) == Actual({'single_bool': True, 'single_dict': {'Empty': 'Empty'}, 'single_float': 10.0, 'single_int': 10, 'single_list': ['Empty'], 'single_str': 'Empty'})
+

Teardown

PASSED test_vscaled_args[arg4-ret4] 0:00:00.000734

Setup

Call

Captured stdout call

+['basic_usage.py', '~single_bool', '-inp_bool=True', '~single_dict', "-inp_dict={'Empty':'Empty'}", '~single_float', '-inp_float=10.0', '~single_int', '-inp_int=10', '~single_list', "-inp_list=['Empty']", '~single_str', '-inp_str=Empty'] : Expected({'single_bool': True, 'single_dict': {'Empty': 'Empty'}, 'single_float': 10.0, 'single_int': 10, 'single_list': ['Empty'], 'single_str': 'Empty'}) == Actual(OrderedDict([('single_bool', True), ('single_dict', {'Empty': 'Empty'}), ('single_float', 10.0), ('single_int', 10), ('single_list', ['Empty']), ('single_str', 'Empty')]))
 
-

Teardown

PASSED test_vscaled_args[arg5-ret5] 0:00:00.001056

Setup

Call

Captured stdout call

-['basic_usage.py', '~multi_args', '-inp_int=10', '-inp_float=10.0', '-inp_str=Seven', "-inp_list=[10,10.0,'Seven']", "-inp_dict={'int':10,'float':10.0,'str':'Seven'}", '-inp_bool=True'] : Expected({'multi_args': {'inp_bool': True, 'inp_dict': {'float': 10.0, 'int': 10, 'str': 'Seven'}, 'inp_float': 10.0, 'inp_int': 10, 'inp_list': [10, 10.0, 'Seven'], 'inp_str': 'Seven'}}) == Actual({'multi_args': {'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [10, 10.0, 'Seven'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': True}})
+

Teardown

PASSED test_vscaled_args[arg5-ret5] 0:00:00.000617

Setup

Call

Captured stdout call

+['basic_usage.py', '~multi_args', '-inp_int=10', '-inp_float=10.0', '-inp_str=Seven', "-inp_list=[10,10.0,'Seven']", "-inp_dict={'int':10,'float':10.0,'str':'Seven'}", '-inp_bool=True'] : Expected({'multi_args': {'inp_bool': True, 'inp_dict': {'float': 10.0, 'int': 10, 'str': 'Seven'}, 'inp_float': 10.0, 'inp_int': 10, 'inp_list': [10, 10.0, 'Seven'], 'inp_str': 'Seven'}}) == Actual(OrderedDict([('multi_args', {'inp_int': 10, 'inp_float': 10.0, 'inp_str': 'Seven', 'inp_list': [10, 10.0, 'Seven'], 'inp_dict': {'int': 10, 'float': 10.0, 'str': 'Seven'}, 'inp_bool': True})]))
 
-

Teardown

TESTS/test_mod_os.py 27 0:00:22.273220

PASSED test_os_calls[python moderate_scripts/basic_usage.py-mod.txt] 0:00:00.730325

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py -h-mod_h.txt] 0:00:00.953436

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py --help-mod_help.txt] 0:00:00.882034

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_int-mod_int.txt] 0:00:00.873409

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_int 10-mod_int_args.txt] 0:00:00.928728

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_int -inp_int=10-mod_int_kwargs.txt] 0:00:01.001362

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_float-mod_float.txt] 0:00:00.787756

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_float 10.0-mod_float_args.txt] 0:00:00.778115

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_float -inp_float=10.0-mod_float_kwargs.txt] 0:00:00.873504

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_str-mod_str.txt] 0:00:00.728461

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_str hello-mod_str_args.txt] 0:00:00.784504

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_str -inp_str=hello-mod_str_kwargs.txt] 0:00:00.745266

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_list-mod_list.txt] 0:00:00.743718

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_list [1,2,3]-mod_list_args.txt] 0:00:00.622983

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_list -inp_list=[1,2,3]-mod_list_kwargs.txt] 0:00:00.750057

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_dict-mod_dict.txt] 0:00:00.786290

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_dict "{'hello':'world'}"-mod_dict_args.txt] 0:00:01.033764

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_dict -inp_dict="{'hello':'world'}"-mod_dict_kwargs.txt] 0:00:00.782460

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_bool-mod_bool.txt] 0:00:00.943338

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_bool True-mod_bool_args.txt] 0:00:00.637565

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_bool -inp_bool=True-mod_bool_kwargs.txt] 0:00:00.802493

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args-mod_multi.txt] 0:00:00.728798

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven "[10,10.0,'Seven']" "{'int':10,'float':10.0,'str':'Seven'}" True-mod_multi_args.txt] 0:00:00.795308

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list="[10,10.0,'Seven']" -inp_dict="{'int':10,'float':10.0,'str':'Seven'}" -inp_bool=True-mod_multi_kwargs.txt] 0:00:00.820864

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven-mod_multi_mix1.txt] 0:00:00.832401

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven -inp_dict="{'int':10,'float':10.0,'str':'Seven'}"-mod_multi_mix2.txt] 0:00:01.047132

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args -inp_dict="{'int':10,'float':10.0,'str':'Seven'}"-mod_multi_mix3.txt] 0:00:00.879150

Setup

Call

Teardown

TESTS/test_mod_warn.py 7 0:00:00.006072

PASSED test_warn_ret_type1 0:00:00.000753

Setup

Call

Captured stdout call
Expected '<class 'int'>' value for 'inp_int' in kwargs of method 'warn_ret_type', got '50.456' instead
-

Teardown

PASSED test_warn_ret_type2 0:00:00.001310

Setup

Call

Captured stdout call
{'warn_ret_type': 50}
-

Teardown

PASSED test_warn_on_arg_order1 0:00:00.000819

Setup

Call

Captured stdout call
Expected '<class 'bool'>' value for 'inp_bool1' in kwargs of method 'warn_on_arg_order', got 'hello' instead
-

Teardown

PASSED test_warn_wo_ret_typ_def2 0:00:00.001036

Setup

Call

Captured stdout call
{'warn_wo_ret_typ_def': 'None'}
-

Teardown

PASSED test_warn_no_support_typ_arg2 0:00:00.000570

Setup

Call

Captured stdout call
Unsupported argument data type : '<class 'pandas.core.frame.DataFrame'>', try using basic types (int, float, str, list, dict, bool) instead
-

Teardown

PASSED test_warn_on_arg_order2 0:00:00.000552

Setup

Call

Captured stdout call
positional argument follows keyword argument 'inp_bool1'
-

Teardown

PASSED test_warn_on_undef_parse_args 0:00:00.001033

Setup

Call

Captured stdout call
Undefined func names : ['dummy_func'], try using defined func names ['multi_args', 'single_bool', 'single_dict', 'single_float', 'single_int', 'single_list', 'single_str', 'warn_no_support_typ_arg', 'warn_on_arg_order', 'warn_ret_type', 'warn_wo_ret_typ_def'] instead
+

Teardown

TESTS/test_mod_os.py 27 0:00:21.176478

PASSED test_os_calls[python moderate_scripts/basic_usage.py-mod.txt] 0:00:00.951063

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py -h-mod_h.txt] 0:00:00.860137

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py --help-mod_help.txt] 0:00:01.072694

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_int-mod_int.txt] 0:00:00.593770

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_int 10-mod_int_args.txt] 0:00:01.367611

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_int -inp_int=10-mod_int_kwargs.txt] 0:00:00.502742

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_float-mod_float.txt] 0:00:00.667041

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_float 10.0-mod_float_args.txt] 0:00:00.947644

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_float -inp_float=10.0-mod_float_kwargs.txt] 0:00:00.549567

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_str-mod_str.txt] 0:00:00.428320

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_str hello-mod_str_args.txt] 0:00:00.639135

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_str -inp_str=hello-mod_str_kwargs.txt] 0:00:00.437411

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_list-mod_list.txt] 0:00:00.925720

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_list [1,2,3]-mod_list_args.txt] 0:00:00.633085

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_list -inp_list=[1,2,3]-mod_list_kwargs.txt] 0:00:01.000697

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_dict-mod_dict.txt] 0:00:00.443134

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_dict "{'hello':'world'}"-mod_dict_args.txt] 0:00:00.835041

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_dict -inp_dict="{'hello':'world'}"-mod_dict_kwargs.txt] 0:00:00.456800

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_bool-mod_bool.txt] 0:00:01.371145

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_bool True-mod_bool_args.txt] 0:00:00.740385

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~single_bool -inp_bool=True-mod_bool_kwargs.txt] 0:00:00.447961

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args-mod_multi.txt] 0:00:00.977064

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven "[10,10.0,'Seven']" "{'int':10,'float':10.0,'str':'Seven'}" True-mod_multi_args.txt] 0:00:00.565893

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list="[10,10.0,'Seven']" -inp_dict="{'int':10,'float':10.0,'str':'Seven'}" -inp_bool=True-mod_multi_kwargs.txt] 0:00:00.853698

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven-mod_multi_mix1.txt] 0:00:01.007807

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven -inp_dict="{'int':10,'float':10.0,'str':'Seven'}"-mod_multi_mix2.txt] 0:00:00.928906

Setup

Call

Teardown

PASSED test_os_calls[python moderate_scripts/basic_usage.py ~multi_args -inp_dict="{'int':10,'float':10.0,'str':'Seven'}"-mod_multi_mix3.txt] 0:00:00.972006

Setup

Call

Teardown

TESTS/test_mod_warn.py 7 0:00:00.003252

PASSED test_warn_ret_type1 0:00:00.000563

Setup

Call

Captured stdout call
Expected '<class 'int'>' value for 'inp_int' in kwargs of method 'warn_ret_type', got '50.456' instead
+

Teardown

PASSED test_warn_ret_type2 0:00:00.000656

Setup

Call

Captured stdout call
OrderedDict([('warn_ret_type', 50)])
+

Teardown

PASSED test_warn_on_arg_order1 0:00:00.000458

Setup

Call

Captured stdout call
Expected '<class 'bool'>' value for 'inp_bool1' in kwargs of method 'warn_on_arg_order', got 'hello' instead
+

Teardown

PASSED test_warn_wo_ret_typ_def2 0:00:00.000458

Setup

Call

Captured stdout call
OrderedDict([('warn_wo_ret_typ_def', 'None')])
+

Teardown

PASSED test_warn_no_support_typ_arg2 0:00:00.000426

Setup

Call

Captured stdout call
Unsupported argument data type : '<class 'pandas.core.frame.DataFrame'>', try using basic types (int, float, str, list, dict, bool) instead
+

Teardown

PASSED test_warn_on_arg_order2 0:00:00.000366

Setup

Call

Captured stdout call
positional argument follows keyword argument 'inp_bool1'
+

Teardown

PASSED test_warn_on_undef_parse_args 0:00:00.000325

Setup

Call

Captured stdout call
Undefined func names : ['dummy_func'], try using defined func names ['multi_args', 'single_bool', 'single_dict', 'single_float', 'single_int', 'single_list', 'single_str', 'warn_no_support_typ_arg', 'warn_on_arg_order', 'warn_ret_type', 'warn_wo_ret_typ_def'] instead
 

Teardown

\ No newline at end of file diff --git a/REPORTS/run_2024-06-02_21-37-01.txt b/REPORTS/run_2024-06-29_21-50-53.txt similarity index 70% rename from REPORTS/run_2024-06-02_21-37-01.txt rename to REPORTS/run_2024-06-29_21-50-53.txt index 898e87c..abdbf74 100644 --- a/REPORTS/run_2024-06-02_21-37-01.txt +++ b/REPORTS/run_2024-06-29_21-50-53.txt @@ -2,14 +2,16 @@ platform win32 -- Python 3.7.16, pytest-6.2.5, py-1.11.0, pluggy-1.2.0 rootdir: D:\GitRepos\py4cli plugins: reporter-0.5.2, reporter-html1-0.8.2 -collected 127 items +collected 153 items -test_min_call.py ...................................... [ 29%] -test_min_os.py ...................................... [ 59%] -test_min_warn.py ........... [ 68%] -test_mod_call.py ...... [ 73%] -test_mod_os.py ........................... [ 94%] +test_max_call.py ................. [ 11%] +test_max_warn.py ......... [ 16%] +test_min_call.py ...................................... [ 41%] +test_min_os.py ...................................... [ 66%] +test_min_warn.py ........... [ 73%] +test_mod_call.py ...... [ 77%] +test_mod_os.py ........................... [ 95%] test_mod_warn.py ....... [100%] ------ generated report: D:\GitRepos\py4cli\REPORTS\TestCaseResults.html ------ -============================ 127 passed in 29.15s ============================= +============================ 153 passed in 26.04s ============================= diff --git a/REPORTS/run_2024-06-02_21-38-09.txt b/REPORTS/run_2024-06-29_21-54-05.txt similarity index 70% rename from REPORTS/run_2024-06-02_21-38-09.txt rename to REPORTS/run_2024-06-29_21-54-05.txt index 7099957..6416300 100644 --- a/REPORTS/run_2024-06-02_21-38-09.txt +++ b/REPORTS/run_2024-06-29_21-54-05.txt @@ -2,14 +2,16 @@ platform linux -- Python 3.7.16, pytest-6.2.5, py-1.11.0, pluggy-1.2.0 rootdir: /mnt/d/GitRepos/py4cli plugins: reporter-0.5.2, reporter-html1-0.8.2 -collected 127 items +collected 153 items -test_min_call.py ...................................... [ 29%] -test_min_os.py ...................................... [ 59%] -test_min_warn.py ........... [ 68%] -test_mod_call.py ...... [ 73%] -test_mod_os.py ........................... [ 94%] +test_max_call.py ................. [ 11%] +test_max_warn.py ......... [ 16%] +test_min_call.py ...................................... [ 41%] +test_min_os.py ...................................... [ 66%] +test_min_warn.py ........... [ 73%] +test_mod_call.py ...... [ 77%] +test_mod_os.py ........................... [ 95%] test_mod_warn.py ....... [100%] ---- generated report: /mnt/d/GitRepos/py4cli/REPORTS/TestCaseResults.html ----- -============================= 127 passed in 56.36s ============================= +============================= 153 passed in 53.31s ============================= diff --git a/SRCS/py4cli/maximal.py b/SRCS/py4cli/maximal.py new file mode 100644 index 0000000..e8e9a12 --- /dev/null +++ b/SRCS/py4cli/maximal.py @@ -0,0 +1,217 @@ + +import sys +import inspect +import __main__ +from collections import OrderedDict +import pathlib +from typing import Union +import yaml +from yaml.loader import SafeLoader +import json + +class cnf_parser: + + def __init__(self, inp: Union[list, str] =sys.argv) -> None: + + self.returned = OrderedDict() + self.__parse(inp) + + def __preproc(self): + + methods = {} + for name, obj in inspect.getmembers(self, predicate=inspect.ismethod): + if not name.startswith('_'): + sign = inspect.signature(obj) + args = [] + kwargs = {} + for key, val in sign.parameters.items(): + if val.default == inspect._empty: + kwargs[key] = { + 'value': val.default, + 'type': val.annotation} + else: + kwargs[key] = { + 'value': val.default, + 'type': val.annotation + } + args.append(key) + methods[name] = { + 'args': args, + 'kwargs': kwargs, + 'ret_type': sign.return_annotation + } + return methods + + def __parse(self, inp): + + reference = self.__preproc() + + if (type(inp) == list and len(inp) == 2): + + if inp[1] in ['-h', '--help']: + print(f"class : {self.__class__.__name__}") + for ref in reference.keys(): + self.__doc(ref) + + if (inp[1].endswith(('yml', 'json', 'yaml'))): + inp_file = pathlib.Path(inp[1]) + self.__proc(reference, inp_file) + + if (type(inp) == str and inp.endswith(('yml', 'json', 'yaml'))): + inp_file = pathlib.Path(inp) + self.__proc(reference, inp_file) + + def __proc(self, reference, inp_file): + + if not inp_file.exists(): + raise FileNotFoundError(inp_file.absolute()) + + if inp_file.name.endswith(('.yml', '.yaml')): + parsed = self.__parse_yml(inp_file) + else: + parsed = self.__parse_json(inp_file) + + self.__validate(inp_file, reference, parsed) + + def __parse_json(self, inp_file): + + with open(inp_file.absolute(), 'r') as file: + try: + raw = json.load(file) + except json.JSONDecodeError as err: + raise SyntaxError(f'{err} in {inp_file.absolute()}') + + # preserving sequnce order + if raw: + ordered = OrderedDict(raw) + else: + ordered = OrderedDict() + parsed = self.__edit(ordered) + return parsed + + def __parse_yml(self, inp_file): + + # parsing from file + with open(inp_file.absolute(), 'r') as stream: + try: + raw = yaml.load(stream, Loader=SafeLoader) + except yaml.YAMLError as err: + raise SyntaxError(f'{err} in {inp_file.absolute()}') + + # preserving sequnce order + if raw: + ordered = OrderedDict(raw) + else: + ordered = OrderedDict() + parsed = self.__edit(ordered) + return parsed + + def __edit(self, ord): + + mod = OrderedDict() + for k, v in ord.items(): + if v == None: + v = {} + mod[k] = v + + return mod + + def __validate(self, inp_file, reference, parsed): + + actm = set(parsed.keys()) + refm = set(reference.keys()) + if actm.issubset(refm): + for func, params in parsed.items(): + schema = reference[func] + args = [] + kwargs = self.__solve_schema(inp_file, func, schema, params) + self.returned[func] = getattr(self, func)(*args, **kwargs) + if schema['ret_type'] != inspect._empty and type(self.returned[func]) != schema['ret_type']: + print( + f"WARNING : '{func}' returns '{type(self.returned[func])}', but defined to return '{schema['ret_type']}'") + else: + methods_available = sorted(list(refm)) + raise Exception(f"Undefined func names : {list(actm-refm)}, try using defined func names {methods_available} instead") + + def __solve_schema(self, inp_file, func_name, func, inps): + + mod_kwargs = {} + for key, val in inps.items(): + var_name = key + type = func['kwargs'][key]['type'] + mod_kwargs[key] = self.__type(inp_file, func_name, var_name, type, val) + + return mod_kwargs + + def __type(self, inp_file, func_name, var_name, dtype, value): + + if dtype in [str, int, float, list, dict, bool, inspect._empty]: + if (dtype == inspect._empty) or (type(value) == dtype): + type_casted_value = value + else: + raise ValueError(f"[{inp_file.absolute()}] : Expected '{dtype}' value for '{var_name}' in kwargs of method '{func_name}', got '{value}' of '{type(value)}' instead") + else: + raise Exception(f"Unsupported argument data type : '{dtype}', try using basic types (int, float, str, list, dict, bool) instead") + + return type_casted_value + + def __doc(self, name): + + print() + print(f" | > def {name} ") + print(f" | ") + obj = getattr(self, name) + func_comments = inspect.getcomments(obj) + if func_comments: + print(" | Description :") + print(f" | ") + comments = func_comments.splitlines() + if len(comments) == 1: + print(f" | { comments[0].replace('#', '').strip() } ") + else: + print(f" | { comments[0].replace('#', '').strip() } ") + for i in range(1, len(comments)-1): + print(f" | { comments[i].replace('#', '').strip() } ") + print(f" | { comments[-1].replace('#', '').strip() } ") + print(f" | ") + + sign = inspect.signature(obj) + args = [str(val) for var, val in sign.parameters.items()] + if args: + print(" | Arguments :") + print(f" | ") + for arg in args: + print(f" | -{arg}") + print(f" | ") + + func_docs = inspect.getdoc(obj) + if func_docs: + print(" | Usage :") + print(f" | ") + docs = func_docs.splitlines() + if len(docs) == 1: + print(f" | { self.__mult_repl(docs[0], {'<__file__>': __main__.__file__, '<__func__>': name}) } ") + else: + print(f" | { self.__mult_repl(docs[0], {'<__file__>': __main__.__file__, '<__func__>': name}) } ") + for i in range(1, len(docs)-1): + print(f" | { self.__mult_repl(docs[i], {'<__file__>': __main__.__file__, '<__func__>': name}) } ") + print(f" | { self.__mult_repl(docs[-1], {'<__file__>': __main__.__file__, '<__func__>': name}) } ") + print(f" | ") + + if sign.return_annotation != sign.empty: + if sign.return_annotation == None: + print(f" | -> {None} (Returnable)") + else: + print( + f" | -> {sign.return_annotation.__name__} (Returnable)") + else: + print(f" | -> Any (Returnable)") + + def __mult_repl(self, str_inp, replacements): + + inp = str_inp.rstrip() + if 'python' in inp: + for key, value in replacements.items(): + inp = inp.replace(key, value) + + return inp diff --git a/SRCS/py4cli/minimal.py b/SRCS/py4cli/minimal.py index 27d0a56..ebe2ec2 100644 --- a/SRCS/py4cli/minimal.py +++ b/SRCS/py4cli/minimal.py @@ -7,10 +7,10 @@ class arg_parser(): - def __init__(self, argv=sys.argv): + def __init__(self, argv:list=sys.argv): methods = [] - self.returned = None + self.returned = {} for name, obj in inspect.getmembers(self, predicate=inspect.ismethod): if not name.startswith('_'): methods.append(name) @@ -19,7 +19,6 @@ def __init__(self, argv=sys.argv): def_func_name = 'parse_args' if def_func_name in methods: if len(argv) == 2 and (argv[1] in ['-h', '--help']): - self.returned = None self.__doc(def_func_name) else: func_schema = self.__func2schema(def_func_name) @@ -52,7 +51,7 @@ def __type(self, var_name, dtype, value): def __validate_and_typecast(self, dtype, value): - if dtype == str: + if type(value) == dtype: return True, value if dtype in [int, float]: @@ -84,7 +83,6 @@ def __solve_schema(self, func, inps): for key, val in inps['kwargs'].items(): var_name = key type = func['kwargs'][key]['type'] - val = val['value'] mod_kwargs[key] = self.__type(var_name, type, val) return mod_args, mod_kwargs @@ -121,7 +119,7 @@ def __args2schema(self, func_name, inp_args): kwargs_found = re.match("^-(\\S+)=(\\S.+)$", inp_args[i]) if kwargs_found: key, value = kwargs_found.groups() - kwargs[key] = {'value': value} + kwargs[key] = value kwargs_started = True else: if kwargs_started: @@ -187,9 +185,9 @@ def __doc(self, name): def __mult_repl(self, str_inp, replacements): - inp = str_inp.strip() + inp = str_inp.rstrip() if 'python' in inp: for key, value in replacements.items(): inp = inp.replace(key, value) - return inp + return inp \ No newline at end of file diff --git a/SRCS/py4cli/moderate.py b/SRCS/py4cli/moderate.py index a172306..7eef62d 100644 --- a/SRCS/py4cli/moderate.py +++ b/SRCS/py4cli/moderate.py @@ -9,10 +9,10 @@ class arg_parser(): - def __init__(self, argv=sys.argv): + def __init__(self, argv:list=sys.argv): methods = [] - self.returned = None + self.returned = OrderedDict() for name, obj in inspect.getmembers(self, predicate=inspect.ismethod): if not name.startswith('_'): methods.append(name) @@ -40,7 +40,6 @@ def __init__(self, argv=sys.argv): if not inv_set.issubset(def_set): raise Exception(f"Undefined func names : {list(inv_set-def_set)}, try using defined func names {methods} instead") - self.returned = {} for func, argv in code_flow.items(): self.returned[func] = self.__solve_func(func, argv) @@ -78,7 +77,7 @@ def __type(self, func_name, var_name, dtype, value): def __validate_and_typecast(self, dtype, value): - if dtype == str: + if type(value) == dtype: return True, value if dtype in [int, float]: @@ -110,7 +109,6 @@ def __solve_schema(self, func_name, func, inps): for key, val in inps['kwargs'].items(): var_name = key type = func['kwargs'][key]['type'] - val = val['value'] mod_kwargs[key] = self.__type(func_name, var_name, type, val) return mod_args, mod_kwargs @@ -147,7 +145,7 @@ def __args2schema(self, func_name, inp_args): kwargs_found = re.match("^-(\\S+)=(\\S.+)$", inp_args[i]) if kwargs_found: key, value = kwargs_found.groups() - kwargs[key] = {'value': value} + kwargs[key] = value kwargs_started = True else: if kwargs_started: @@ -213,7 +211,7 @@ def __doc(self, name): def __mult_repl(self, str_inp, replacements): - inp = str_inp.strip() + inp = str_inp.rstrip() if 'python' in inp: for key, value in replacements.items(): inp = inp.replace(key, value) diff --git a/TESTS/maximal_scripts/a/a.json b/TESTS/maximal_scripts/a/a.json new file mode 100644 index 0000000..f70ed74 --- /dev/null +++ b/TESTS/maximal_scripts/a/a.json @@ -0,0 +1,6 @@ +{ + "subclasses": { + "aa": "maximal_scripts/a/aa/aa.json", + "ab": "maximal_scripts/a/ab/ab.json" + } +} \ No newline at end of file diff --git a/TESTS/maximal_scripts/a/a.py b/TESTS/maximal_scripts/a/a.py new file mode 100644 index 0000000..9579924 --- /dev/null +++ b/TESTS/maximal_scripts/a/a.py @@ -0,0 +1,51 @@ +from py4cli.maximal import cnf_parser + +try: + from .aa.aa import AA + from .ab.ab import AB +except: + from aa.aa import AA + from ab.ab import AB + +class A(cnf_parser): + + # Path of files aa & ab to be passed in as arguments + def subclasses(self, aa:str, ab:str): + """ + a.yml: + + subclasses: + aa: aa.yml + ab: ab.yml + + a.json: + + { + "subclasses": { + "aa": "aa.json", + "ab": "ab.json" + } + } + + cmds: + 1. python <__file__> a.yml + 2. python <__file__> a.json + """ + results = {} + results["ret_aa"] = AA(aa).returned + results["ret_ab"] = AB(ab).returned + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = A() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/TESTS/maximal_scripts/a/a.yml b/TESTS/maximal_scripts/a/a.yml new file mode 100644 index 0000000..da82e0b --- /dev/null +++ b/TESTS/maximal_scripts/a/a.yml @@ -0,0 +1,4 @@ + +subclasses: + aa: maximal_scripts/a/aa/aa.yml + ab: maximal_scripts/a/ab/ab.yml \ No newline at end of file diff --git a/TESTS/maximal_scripts/a/aa/aa.json b/TESTS/maximal_scripts/a/aa/aa.json new file mode 100644 index 0000000..6de428c --- /dev/null +++ b/TESTS/maximal_scripts/a/aa/aa.json @@ -0,0 +1,24 @@ +{ + "sub_func": { + "aaa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } +} \ No newline at end of file diff --git a/TESTS/maximal_scripts/a/aa/aa.py b/TESTS/maximal_scripts/a/aa/aa.py new file mode 100644 index 0000000..979bd8c --- /dev/null +++ b/TESTS/maximal_scripts/a/aa/aa.py @@ -0,0 +1,69 @@ +from py4cli.maximal import cnf_parser + +class AA(cnf_parser): + + # params aaa, aab, aac, aad to be passed in as arguments + # return type explicitly specified as None, for test coverage of warning + # return type explicitly specified as None, for test coverage of warning + # return type explicitly specified as None, for test coverage of warning + def sub_func(self, aaa:dict, aab:dict, aac:dict, aad:dict={}) -> dict: + """ + aa.yml: + + sub_func: + aaa: { "k1": "v1", "k2": "v2", "k3": "v3" } + aab: { "k1": "v1", "k2": "v2", "k3": "v3" } + aac: { "k1": "v1", "k2": "v2", "k3": "v3" } + aad: { "k1": "v1", "k2": "v2", "k3": "v3" } + + aa.json: + + { + "subfunc": { + "aaa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "aad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + + cmds: + 1. python <__file__> aa.yml + 2. python <__file__> aa.json + """ + results = {} + results["ret_aaa"] = aaa + results["ret_aab"] = aab + results["ret_aac"] = aac + results["ret_aad"] = aad + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = AA() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/TESTS/maximal_scripts/a/aa/aa.yml b/TESTS/maximal_scripts/a/aa/aa.yml new file mode 100644 index 0000000..517b166 --- /dev/null +++ b/TESTS/maximal_scripts/a/aa/aa.yml @@ -0,0 +1,5 @@ +sub_func: + aaa: { "k1": "v1", "k2": "v2", "k3": "v3" } + aab: { "k1": "v1", "k2": "v2", "k3": "v3" } + aac: { "k1": "v1", "k2": "v2", "k3": "v3" } + aad: { "k1": "v1", "k2": "v2", "k3": "v3" } diff --git a/TESTS/maximal_scripts/a/ab/ab.json b/TESTS/maximal_scripts/a/ab/ab.json new file mode 100644 index 0000000..9cc0e8c --- /dev/null +++ b/TESTS/maximal_scripts/a/ab/ab.json @@ -0,0 +1,24 @@ +{ + "sub_func": { + "aba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } +} \ No newline at end of file diff --git a/TESTS/maximal_scripts/a/ab/ab.py b/TESTS/maximal_scripts/a/ab/ab.py new file mode 100644 index 0000000..41ff17b --- /dev/null +++ b/TESTS/maximal_scripts/a/ab/ab.py @@ -0,0 +1,69 @@ +from py4cli.maximal import cnf_parser + +class AB(cnf_parser): + + # params aba, abb, abc, abd to be passed in as arguments + # return type explicitly specified as None, for test coverage of warning + # return type explicitly specified as None, for test coverage of warning + # return type explicitly specified as None, for test coverage of warning + def sub_func(self, aba:dict, abb:dict, abc:dict, abd:dict) -> dict: + """ + ab.yml: + + sub_func: + aba: { "k1": "v1", "k2": "v2", "k3": "v3" } + abb: { "k1": "v1", "k2": "v2", "k3": "v3" } + abc: { "k1": "v1", "k2": "v2", "k3": "v3" } + abd: { "k1": "v1", "k2": "v2", "k3": "v3" } + + ab.json: + + { + "subfunc": { + "aba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "abd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + + cmds: + 1. python <__file__> ab.yml + 2. python <__file__> ab.json + """ + results = {} + results["ret_aba"] = aba + results["ret_abb"] = abb + results["ret_abc"] = abc + results["ret_abd"] = abd + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = AB() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/TESTS/maximal_scripts/a/ab/ab.yml b/TESTS/maximal_scripts/a/ab/ab.yml new file mode 100644 index 0000000..673d0c5 --- /dev/null +++ b/TESTS/maximal_scripts/a/ab/ab.yml @@ -0,0 +1,5 @@ +sub_func: + aba: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + abb: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + abc: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + abd: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} \ No newline at end of file diff --git a/TESTS/maximal_scripts/b/b.json b/TESTS/maximal_scripts/b/b.json new file mode 100644 index 0000000..7c02533 --- /dev/null +++ b/TESTS/maximal_scripts/b/b.json @@ -0,0 +1,6 @@ +{ + "subclasses": { + "ba": "maximal_scripts/b/ba/ba.json", + "bb": "maximal_scripts/b/bb/bb.json" + } +} \ No newline at end of file diff --git a/TESTS/maximal_scripts/b/b.py b/TESTS/maximal_scripts/b/b.py new file mode 100644 index 0000000..ab04bd4 --- /dev/null +++ b/TESTS/maximal_scripts/b/b.py @@ -0,0 +1,51 @@ +from py4cli.maximal import cnf_parser + +try: + from .ba.ba import BA + from .bb.bb import BB +except: + from ba.ba import BA + from bb.bb import BB + +class B(cnf_parser): + + # Path of files ba & bb to be passed in as arguments + def subclasses(self, ba:str, bb:str): + """ + b.yml: + + subclasses: + ba: ba.yml + bb: bb.yml + + b.json: + + { + "subclasses": { + "ba": "ba.json", + "bb": "bb.json" + } + } + + cmds: + 1. python <__file__> b.yml + 2. python <__file__> b.json + """ + results = {} + results["ret_ba"] = BA(ba).returned + results["ret_bb"] = BB(bb).returned + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = B() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/TESTS/maximal_scripts/b/b.yml b/TESTS/maximal_scripts/b/b.yml new file mode 100644 index 0000000..f71c5c4 --- /dev/null +++ b/TESTS/maximal_scripts/b/b.yml @@ -0,0 +1,4 @@ + +subclasses: + ba: maximal_scripts/b/ba/ba.yml + bb: maximal_scripts/b/bb/bb.yml \ No newline at end of file diff --git a/TESTS/maximal_scripts/b/ba/ba.json b/TESTS/maximal_scripts/b/ba/ba.json new file mode 100644 index 0000000..ac9dc9d --- /dev/null +++ b/TESTS/maximal_scripts/b/ba/ba.json @@ -0,0 +1,24 @@ +{ + "sub_func": { + "baa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } +} \ No newline at end of file diff --git a/TESTS/maximal_scripts/b/ba/ba.py b/TESTS/maximal_scripts/b/ba/ba.py new file mode 100644 index 0000000..ff8ac1b --- /dev/null +++ b/TESTS/maximal_scripts/b/ba/ba.py @@ -0,0 +1,69 @@ +from py4cli.maximal import cnf_parser + +class BA(cnf_parser): + + # params baa, bab, bac, bad to be passed in as arguments + # return type explicitly specified as None, for test coverage of warning + # return type explicitly specified as None, for test coverage of warning + # return type explicitly specified as None, for test coverage of warning + def sub_func(self, baa:dict, bab:dict, bac:dict, bad:dict) -> None: + """ + ba.yml: + + sub_func: + baa: { "k1": "v1", "k2": "v2", "k3": "v3" } + bab: { "k1": "v1", "k2": "v2", "k3": "v3" } + bac: { "k1": "v1", "k2": "v2", "k3": "v3" } + bad: { "k1": "v1", "k2": "v2", "k3": "v3" } + + ba.json: + + { + "subfunc": { + "baa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + + cmds: + 1. python <__file__> ba.yml + 2. python <__file__> bb.json + """ + results = {} + results["ret_baa"] = baa + results["ret_bab"] = bab + results["ret_bac"] = bac + results["ret_bad"] = bad + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = BA() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/TESTS/maximal_scripts/b/ba/ba.yml b/TESTS/maximal_scripts/b/ba/ba.yml new file mode 100644 index 0000000..0f0d141 --- /dev/null +++ b/TESTS/maximal_scripts/b/ba/ba.yml @@ -0,0 +1,5 @@ +sub_func: + baa: { "k1": "v1", "k2": "v2", "k3": "v3" } + bab: { "k1": "v1", "k2": "v2", "k3": "v3" } + bac: { "k1": "v1", "k2": "v2", "k3": "v3" } + bad: { "k1": "v1", "k2": "v2", "k3": "v3" } diff --git a/TESTS/maximal_scripts/b/bb/bb.json b/TESTS/maximal_scripts/b/bb/bb.json new file mode 100644 index 0000000..74afc2f --- /dev/null +++ b/TESTS/maximal_scripts/b/bb/bb.json @@ -0,0 +1,24 @@ +{ + "sub_func": { + "bba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } +} \ No newline at end of file diff --git a/TESTS/maximal_scripts/b/bb/bb.py b/TESTS/maximal_scripts/b/bb/bb.py new file mode 100644 index 0000000..a714387 --- /dev/null +++ b/TESTS/maximal_scripts/b/bb/bb.py @@ -0,0 +1,69 @@ +from py4cli.maximal import cnf_parser + +class BB(cnf_parser): + + # params bba, bbb, bbc, bbd to be passed in as arguments + # return type explicitly specified as None, for test coverage of warning + # return type explicitly specified as None, for test coverage of warning + # return type explicitly specified as None, for test coverage of warning + def sub_func(self, bba:dict, bbb:dict, bbc:dict, bbd:dict) -> None: + """ + bb.yml: + + sub_func: + bba: { "k1": "v1", "k2": "v2", "k3": "v3" } + bbb: { "k1": "v1", "k2": "v2", "k3": "v3" } + bbc: { "k1": "v1", "k2": "v2", "k3": "v3" } + bbd: { "k1": "v1", "k2": "v2", "k3": "v3" } + + bb.json: + + { + "subfunc": { + "bba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "bbd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + + cmds: + 1. python <__file__> bb.yml + 2. python <__file__> bb.json + """ + results = {} + results["ret_bba"] = bba + results["ret_bbb"] = bbb + results["ret_bbc"] = bbc + results["ret_bbd"] = bbd + return results + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = BB() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/TESTS/maximal_scripts/b/bb/bb.yml b/TESTS/maximal_scripts/b/bb/bb.yml new file mode 100644 index 0000000..c59b55d --- /dev/null +++ b/TESTS/maximal_scripts/b/bb/bb.yml @@ -0,0 +1,5 @@ +sub_func: + bba: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + bbb: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + bbc: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} + bbd: {'k1': 'v1', 'k2': 'v2', 'k3': 'v3'} \ No newline at end of file diff --git a/TESTS/maximal_scripts/demo.json b/TESTS/maximal_scripts/demo.json new file mode 100644 index 0000000..c88f946 --- /dev/null +++ b/TESTS/maximal_scripts/demo.json @@ -0,0 +1,6 @@ +{ + "classes": { + "a": "maximal_scripts/a/a.json", + "b": "maximal_scripts/b/b.json" + } +} \ No newline at end of file diff --git a/TESTS/maximal_scripts/demo.py b/TESTS/maximal_scripts/demo.py new file mode 100644 index 0000000..4ad3271 --- /dev/null +++ b/TESTS/maximal_scripts/demo.py @@ -0,0 +1,54 @@ + +from py4cli.maximal import cnf_parser +import pandas as pd + +from maximal_scripts.a.a import A +from maximal_scripts.b.b import B + +class demo(cnf_parser): + + # Path of files a & b to be passed in as arguments + def classes(self, a:str, b:str): + """python <__file__> demo.yml or python <__file__> demo.json""" + # """ + # demo.yml: + + # classes: + # a: a.yml + # b: b.yml + + # demo.json: + + # { + # "classes": { + # "a": "a.json", + # "b": "b.json" + # } + # } + + # cmds: + # 1. python <__file__> demo.yml + # 2. python <__file__> demo.json + # """ + results = {} + results["ret_a"] = A(a).returned + results["ret_b"] = B(b).returned + return results + + def err_on_df(self, df: pd.DataFrame): + + return None + +if __name__ == '__main__': + + import sys + import json + + print(sys.argv) + obj = demo() + print("") + if obj.returned: + out_dict = obj.returned.copy() + print(json.dumps(out_dict, indent=2, sort_keys=False), type(obj.returned)) + else: + print(obj.returned, type(obj.returned)) \ No newline at end of file diff --git a/TESTS/maximal_scripts/demo.yml b/TESTS/maximal_scripts/demo.yml new file mode 100644 index 0000000..fd9ebb2 --- /dev/null +++ b/TESTS/maximal_scripts/demo.yml @@ -0,0 +1,3 @@ +classes: + a: maximal_scripts/a/a.yml + b: maximal_scripts/b/b.yml \ No newline at end of file diff --git a/TESTS/maximal_scripts/empty.json b/TESTS/maximal_scripts/empty.json new file mode 100644 index 0000000..e69de29 diff --git a/TESTS/maximal_scripts/empty.yml b/TESTS/maximal_scripts/empty.yml new file mode 100644 index 0000000..e69de29 diff --git a/TESTS/maximal_scripts/error.yml b/TESTS/maximal_scripts/error.yml new file mode 100644 index 0000000..b1482f9 --- /dev/null +++ b/TESTS/maximal_scripts/error.yml @@ -0,0 +1,5 @@ +!dk + + + + diff --git a/TESTS/maximal_scripts/func_err.yml b/TESTS/maximal_scripts/func_err.yml new file mode 100644 index 0000000..e9c37ce --- /dev/null +++ b/TESTS/maximal_scripts/func_err.yml @@ -0,0 +1,4 @@ + +classes: +subclasses: +sub_func: \ No newline at end of file diff --git a/TESTS/maximal_scripts/none.json b/TESTS/maximal_scripts/none.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/TESTS/maximal_scripts/none.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/TESTS/maximal_scripts/none.yml b/TESTS/maximal_scripts/none.yml new file mode 100644 index 0000000..267c47f --- /dev/null +++ b/TESTS/maximal_scripts/none.yml @@ -0,0 +1 @@ +classes: \ No newline at end of file diff --git a/TESTS/maximal_scripts/type_err1.yml b/TESTS/maximal_scripts/type_err1.yml new file mode 100644 index 0000000..7c669cc --- /dev/null +++ b/TESTS/maximal_scripts/type_err1.yml @@ -0,0 +1,4 @@ + +classes: + a: 100 + b: 200 \ No newline at end of file diff --git a/TESTS/maximal_scripts/type_err2.yml b/TESTS/maximal_scripts/type_err2.yml new file mode 100644 index 0000000..26f643e --- /dev/null +++ b/TESTS/maximal_scripts/type_err2.yml @@ -0,0 +1,2 @@ +err_on_df: + df: "dummy" \ No newline at end of file diff --git a/TESTS/ref_files/min_bool_h.txt b/TESTS/ref_files/min_bool_h.txt index fcffbb0..6e9355f 100644 --- a/TESTS/ref_files/min_bool_h.txt +++ b/TESTS/ref_files/min_bool_h.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_bool.py True - | 2. python minimal_scripts/use_bool.py -inp_bool=True + | 1. python minimal_scripts/use_bool.py True + | 2. python minimal_scripts/use_bool.py -inp_bool=True | | -> bool (Returnable) -None +{} diff --git a/TESTS/ref_files/min_bool_help.txt b/TESTS/ref_files/min_bool_help.txt index 4d8a608..2249d57 100644 --- a/TESTS/ref_files/min_bool_help.txt +++ b/TESTS/ref_files/min_bool_help.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_bool.py True - | 2. python minimal_scripts/use_bool.py -inp_bool=True + | 1. python minimal_scripts/use_bool.py True + | 2. python minimal_scripts/use_bool.py -inp_bool=True | | -> bool (Returnable) -None +{} diff --git a/TESTS/ref_files/min_dict_h.txt b/TESTS/ref_files/min_dict_h.txt index d85212d..c4e29e7 100644 --- a/TESTS/ref_files/min_dict_h.txt +++ b/TESTS/ref_files/min_dict_h.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_dict.py {"Empty":"Empty"} - | 2. python minimal_scripts/use_dict.py -inp_dict={"Empty":"Empty"} + | 1. python minimal_scripts/use_dict.py {"Empty":"Empty"} + | 2. python minimal_scripts/use_dict.py -inp_dict={"Empty":"Empty"} | | -> dict (Returnable) -None +{} diff --git a/TESTS/ref_files/min_dict_help.txt b/TESTS/ref_files/min_dict_help.txt index 73df318..55d1646 100644 --- a/TESTS/ref_files/min_dict_help.txt +++ b/TESTS/ref_files/min_dict_help.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_dict.py {"Empty":"Empty"} - | 2. python minimal_scripts/use_dict.py -inp_dict={"Empty":"Empty"} + | 1. python minimal_scripts/use_dict.py {"Empty":"Empty"} + | 2. python minimal_scripts/use_dict.py -inp_dict={"Empty":"Empty"} | | -> dict (Returnable) -None +{} diff --git a/TESTS/ref_files/min_float_h.txt b/TESTS/ref_files/min_float_h.txt index 713f789..f50e9d1 100644 --- a/TESTS/ref_files/min_float_h.txt +++ b/TESTS/ref_files/min_float_h.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_float.py 10.0 - | 2. python minimal_scripts/use_float.py -inp_float=10.0 + | 1. python minimal_scripts/use_float.py 10.0 + | 2. python minimal_scripts/use_float.py -inp_float=10.0 | | -> float (Returnable) -None +{} diff --git a/TESTS/ref_files/min_float_help.txt b/TESTS/ref_files/min_float_help.txt index 9ac749c..0c109f7 100644 --- a/TESTS/ref_files/min_float_help.txt +++ b/TESTS/ref_files/min_float_help.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_float.py 10.0 - | 2. python minimal_scripts/use_float.py -inp_float=10.0 + | 1. python minimal_scripts/use_float.py 10.0 + | 2. python minimal_scripts/use_float.py -inp_float=10.0 | | -> float (Returnable) -None +{} diff --git a/TESTS/ref_files/min_int_h.txt b/TESTS/ref_files/min_int_h.txt index 060ce36..bc8fc0f 100644 --- a/TESTS/ref_files/min_int_h.txt +++ b/TESTS/ref_files/min_int_h.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_int.py 10 - | 2. python minimal_scripts/use_int.py -inp_int=10 + | 1. python minimal_scripts/use_int.py 10 + | 2. python minimal_scripts/use_int.py -inp_int=10 | | -> int (Returnable) -None +{} diff --git a/TESTS/ref_files/min_int_help.txt b/TESTS/ref_files/min_int_help.txt index 8ec511a..db3a205 100644 --- a/TESTS/ref_files/min_int_help.txt +++ b/TESTS/ref_files/min_int_help.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_int.py 10 - | 2. python minimal_scripts/use_int.py -inp_int=10 + | 1. python minimal_scripts/use_int.py 10 + | 2. python minimal_scripts/use_int.py -inp_int=10 | | -> int (Returnable) -None +{} diff --git a/TESTS/ref_files/min_list_h.txt b/TESTS/ref_files/min_list_h.txt index 0ded927..2dcd090 100644 --- a/TESTS/ref_files/min_list_h.txt +++ b/TESTS/ref_files/min_list_h.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_list.py ["Empty"] - | 2. python minimal_scripts/use_list.py -inp_list=["Empty"] + | 1. python minimal_scripts/use_list.py ["Empty"] + | 2. python minimal_scripts/use_list.py -inp_list=["Empty"] | | -> list (Returnable) -None +{} diff --git a/TESTS/ref_files/min_list_help.txt b/TESTS/ref_files/min_list_help.txt index dabaae5..cef1158 100644 --- a/TESTS/ref_files/min_list_help.txt +++ b/TESTS/ref_files/min_list_help.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_list.py ["Empty"] - | 2. python minimal_scripts/use_list.py -inp_list=["Empty"] + | 1. python minimal_scripts/use_list.py ["Empty"] + | 2. python minimal_scripts/use_list.py -inp_list=["Empty"] | | -> list (Returnable) -None +{} diff --git a/TESTS/ref_files/min_multi_h.txt b/TESTS/ref_files/min_multi_h.txt index e9bba4c..ad02ba8 100644 --- a/TESTS/ref_files/min_multi_h.txt +++ b/TESTS/ref_files/min_multi_h.txt @@ -22,9 +22,9 @@ | the function returns a dict containing all the arguments and its values. | | cmds : - | 1. python minimal_scripts/multi_args.py 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True - | 2. python minimal_scripts/multi_args.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True + | 1. python minimal_scripts/multi_args.py 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True + | 2. python minimal_scripts/multi_args.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True | | -> dict (Returnable) -None +{} diff --git a/TESTS/ref_files/min_multi_help.txt b/TESTS/ref_files/min_multi_help.txt index bdc11f5..c46304c 100644 --- a/TESTS/ref_files/min_multi_help.txt +++ b/TESTS/ref_files/min_multi_help.txt @@ -22,9 +22,9 @@ | the function returns a dict containing all the arguments and its values. | | cmds : - | 1. python minimal_scripts/multi_args.py 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True - | 2. python minimal_scripts/multi_args.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True + | 1. python minimal_scripts/multi_args.py 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True + | 2. python minimal_scripts/multi_args.py -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True | | -> dict (Returnable) -None +{} diff --git a/TESTS/ref_files/min_str_h.txt b/TESTS/ref_files/min_str_h.txt index 39d5812..ae001c7 100644 --- a/TESTS/ref_files/min_str_h.txt +++ b/TESTS/ref_files/min_str_h.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_str.py Empty - | 2. python minimal_scripts/use_str.py -inp_str=Empty + | 1. python minimal_scripts/use_str.py Empty + | 2. python minimal_scripts/use_str.py -inp_str=Empty | | -> str (Returnable) -None +{} diff --git a/TESTS/ref_files/min_str_help.txt b/TESTS/ref_files/min_str_help.txt index 40ca48a..5a09b59 100644 --- a/TESTS/ref_files/min_str_help.txt +++ b/TESTS/ref_files/min_str_help.txt @@ -17,9 +17,9 @@ | the function returns the same arg value as type | | cmds : - | 1. python minimal_scripts/use_str.py Empty - | 2. python minimal_scripts/use_str.py -inp_str=Empty + | 1. python minimal_scripts/use_str.py Empty + | 2. python minimal_scripts/use_str.py -inp_str=Empty | | -> str (Returnable) -None +{} diff --git a/TESTS/ref_files/mod.txt b/TESTS/ref_files/mod.txt index 19ee470..797ac51 100644 --- a/TESTS/ref_files/mod.txt +++ b/TESTS/ref_files/mod.txt @@ -14,4 +14,4 @@ Methods available for use, is listed below "~warn_wo_ret_typ_def" ] -None +OrderedDict() diff --git a/TESTS/ref_files/mod_bool.txt b/TESTS/ref_files/mod_bool.txt index 2436798..3d3549a 100644 --- a/TESTS/ref_files/mod_bool.txt +++ b/TESTS/ref_files/mod_bool.txt @@ -2,4 +2,4 @@ { "single_bool": false -} +} diff --git a/TESTS/ref_files/mod_bool_args.txt b/TESTS/ref_files/mod_bool_args.txt index 521689e..be38366 100644 --- a/TESTS/ref_files/mod_bool_args.txt +++ b/TESTS/ref_files/mod_bool_args.txt @@ -2,4 +2,4 @@ { "single_bool": true -} +} diff --git a/TESTS/ref_files/mod_bool_kwargs.txt b/TESTS/ref_files/mod_bool_kwargs.txt index 9afa522..a346464 100644 --- a/TESTS/ref_files/mod_bool_kwargs.txt +++ b/TESTS/ref_files/mod_bool_kwargs.txt @@ -2,4 +2,4 @@ { "single_bool": true -} +} diff --git a/TESTS/ref_files/mod_dict.txt b/TESTS/ref_files/mod_dict.txt index a330706..1e00ec2 100644 --- a/TESTS/ref_files/mod_dict.txt +++ b/TESTS/ref_files/mod_dict.txt @@ -4,4 +4,4 @@ "single_dict": { "null": null } -} +} diff --git a/TESTS/ref_files/mod_dict_args.txt b/TESTS/ref_files/mod_dict_args.txt index ab888c4..174b5c0 100644 --- a/TESTS/ref_files/mod_dict_args.txt +++ b/TESTS/ref_files/mod_dict_args.txt @@ -4,4 +4,4 @@ "single_dict": { "hello": "world" } -} +} diff --git a/TESTS/ref_files/mod_dict_kwargs.txt b/TESTS/ref_files/mod_dict_kwargs.txt index 1ce051b..774504a 100644 --- a/TESTS/ref_files/mod_dict_kwargs.txt +++ b/TESTS/ref_files/mod_dict_kwargs.txt @@ -4,4 +4,4 @@ "single_dict": { "hello": "world" } -} +} diff --git a/TESTS/ref_files/mod_float.txt b/TESTS/ref_files/mod_float.txt index 76610ee..a9a455f 100644 --- a/TESTS/ref_files/mod_float.txt +++ b/TESTS/ref_files/mod_float.txt @@ -2,4 +2,4 @@ { "single_float": 0.0 -} +} diff --git a/TESTS/ref_files/mod_float_args.txt b/TESTS/ref_files/mod_float_args.txt index c3ebe19..281eb26 100644 --- a/TESTS/ref_files/mod_float_args.txt +++ b/TESTS/ref_files/mod_float_args.txt @@ -2,4 +2,4 @@ { "single_float": 10.0 -} +} diff --git a/TESTS/ref_files/mod_float_kwargs.txt b/TESTS/ref_files/mod_float_kwargs.txt index 6391f6a..3fb409e 100644 --- a/TESTS/ref_files/mod_float_kwargs.txt +++ b/TESTS/ref_files/mod_float_kwargs.txt @@ -2,4 +2,4 @@ { "single_float": 10.0 -} +} diff --git a/TESTS/ref_files/mod_h.txt b/TESTS/ref_files/mod_h.txt index 4cb028c..ba94192 100644 --- a/TESTS/ref_files/mod_h.txt +++ b/TESTS/ref_files/mod_h.txt @@ -22,8 +22,8 @@ | the function returns a dict containing all the arguments and its values. | | cmds : - | 1. python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True - | 2. python moderate_scripts/basic_usage.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True + | 1. python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True + | 2. python moderate_scripts/basic_usage.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True | | -> dict (Returnable) @@ -44,8 +44,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_bool True - | 2. python moderate_scripts/basic_usage.py ~single_bool -inp_bool=True + | 1. python moderate_scripts/basic_usage.py ~single_bool True + | 2. python moderate_scripts/basic_usage.py ~single_bool -inp_bool=True | | -> bool (Returnable) @@ -66,8 +66,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_dict {'Empty':'Empty'} - | 2. python moderate_scripts/basic_usage.py ~single_dict -inp_dict={'Empty':'Empty'} + | 1. python moderate_scripts/basic_usage.py ~single_dict {'Empty':'Empty'} + | 2. python moderate_scripts/basic_usage.py ~single_dict -inp_dict={'Empty':'Empty'} | | -> dict (Returnable) @@ -88,8 +88,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_float 10.0 - | 2. python moderate_scripts/basic_usage.py ~single_float -inp_float=10.0 + | 1. python moderate_scripts/basic_usage.py ~single_float 10.0 + | 2. python moderate_scripts/basic_usage.py ~single_float -inp_float=10.0 | | -> float (Returnable) @@ -110,8 +110,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_int 10 - | 2. python moderate_scripts/basic_usage.py ~single_int -inp_int=10 + | 1. python moderate_scripts/basic_usage.py ~single_int 10 + | 2. python moderate_scripts/basic_usage.py ~single_int -inp_int=10 | | -> int (Returnable) @@ -132,8 +132,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_list ['Empty'] - | 2. python moderate_scripts/basic_usage.py ~single_list -inp_list=['Empty'] + | 1. python moderate_scripts/basic_usage.py ~single_list ['Empty'] + | 2. python moderate_scripts/basic_usage.py ~single_list -inp_list=['Empty'] | | -> list (Returnable) @@ -154,8 +154,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_str "Empty" - | 2. python moderate_scripts/basic_usage.py ~single_str -inp_str="Empty" + | 1. python moderate_scripts/basic_usage.py ~single_str "Empty" + | 2. python moderate_scripts/basic_usage.py ~single_str -inp_str="Empty" | | -> str (Returnable) @@ -211,8 +211,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~warn_ret_type 10 - | 2. python moderate_scripts/basic_usage.py ~warn_ret_type -inp_int=10 + | 1. python moderate_scripts/basic_usage.py ~warn_ret_type 10 + | 2. python moderate_scripts/basic_usage.py ~warn_ret_type -inp_int=10 | | -> str (Returnable) @@ -233,9 +233,9 @@ | the function returns the same arg value | | cmds : - | 1. python moderate_scripts/basic_usage.py ~warn_wo_ret_typ_def True - | 2. python moderate_scripts/basic_usage.py ~warn_wo_ret_typ_def -inp_bool=True + | 1. python moderate_scripts/basic_usage.py ~warn_wo_ret_typ_def True + | 2. python moderate_scripts/basic_usage.py ~warn_wo_ret_typ_def -inp_bool=True | | -> Any (Returnable) -None +OrderedDict() diff --git a/TESTS/ref_files/mod_help.txt b/TESTS/ref_files/mod_help.txt index 57f5bcb..9acab8b 100644 --- a/TESTS/ref_files/mod_help.txt +++ b/TESTS/ref_files/mod_help.txt @@ -22,8 +22,8 @@ | the function returns a dict containing all the arguments and its values. | | cmds : - | 1. python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True - | 2. python moderate_scripts/basic_usage.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True + | 1. python moderate_scripts/basic_usage.py ~multi_args 10 10.0 Seven [10,10.0,'Seven'] {'int':10,'float':10.0,'str':'Seven'} True + | 2. python moderate_scripts/basic_usage.py ~multi_args -inp_int=10 -inp_float=10.0 -inp_str=Seven -inp_list=[10,10.0,'Seven'] -inp_dict={'int':10,'float':10.0,'str':'Seven'} -inp_bool=True | | -> dict (Returnable) @@ -44,8 +44,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_bool True - | 2. python moderate_scripts/basic_usage.py ~single_bool -inp_bool=True + | 1. python moderate_scripts/basic_usage.py ~single_bool True + | 2. python moderate_scripts/basic_usage.py ~single_bool -inp_bool=True | | -> bool (Returnable) @@ -66,8 +66,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_dict {'Empty':'Empty'} - | 2. python moderate_scripts/basic_usage.py ~single_dict -inp_dict={'Empty':'Empty'} + | 1. python moderate_scripts/basic_usage.py ~single_dict {'Empty':'Empty'} + | 2. python moderate_scripts/basic_usage.py ~single_dict -inp_dict={'Empty':'Empty'} | | -> dict (Returnable) @@ -88,8 +88,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_float 10.0 - | 2. python moderate_scripts/basic_usage.py ~single_float -inp_float=10.0 + | 1. python moderate_scripts/basic_usage.py ~single_float 10.0 + | 2. python moderate_scripts/basic_usage.py ~single_float -inp_float=10.0 | | -> float (Returnable) @@ -110,8 +110,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_int 10 - | 2. python moderate_scripts/basic_usage.py ~single_int -inp_int=10 + | 1. python moderate_scripts/basic_usage.py ~single_int 10 + | 2. python moderate_scripts/basic_usage.py ~single_int -inp_int=10 | | -> int (Returnable) @@ -132,8 +132,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_list ['Empty'] - | 2. python moderate_scripts/basic_usage.py ~single_list -inp_list=['Empty'] + | 1. python moderate_scripts/basic_usage.py ~single_list ['Empty'] + | 2. python moderate_scripts/basic_usage.py ~single_list -inp_list=['Empty'] | | -> list (Returnable) @@ -154,8 +154,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~single_str "Empty" - | 2. python moderate_scripts/basic_usage.py ~single_str -inp_str="Empty" + | 1. python moderate_scripts/basic_usage.py ~single_str "Empty" + | 2. python moderate_scripts/basic_usage.py ~single_str -inp_str="Empty" | | -> str (Returnable) @@ -211,8 +211,8 @@ | the function returns the same arg value as type | | cmds : - | 1. python moderate_scripts/basic_usage.py ~warn_ret_type 10 - | 2. python moderate_scripts/basic_usage.py ~warn_ret_type -inp_int=10 + | 1. python moderate_scripts/basic_usage.py ~warn_ret_type 10 + | 2. python moderate_scripts/basic_usage.py ~warn_ret_type -inp_int=10 | | -> str (Returnable) @@ -233,9 +233,9 @@ | the function returns the same arg value | | cmds : - | 1. python moderate_scripts/basic_usage.py ~warn_wo_ret_typ_def True - | 2. python moderate_scripts/basic_usage.py ~warn_wo_ret_typ_def -inp_bool=True + | 1. python moderate_scripts/basic_usage.py ~warn_wo_ret_typ_def True + | 2. python moderate_scripts/basic_usage.py ~warn_wo_ret_typ_def -inp_bool=True | | -> Any (Returnable) -None +OrderedDict() diff --git a/TESTS/ref_files/mod_int.txt b/TESTS/ref_files/mod_int.txt index e4b88de..9d56bc3 100644 --- a/TESTS/ref_files/mod_int.txt +++ b/TESTS/ref_files/mod_int.txt @@ -2,4 +2,4 @@ { "single_int": 0 -} +} diff --git a/TESTS/ref_files/mod_int_args.txt b/TESTS/ref_files/mod_int_args.txt index db7e4ef..fab0277 100644 --- a/TESTS/ref_files/mod_int_args.txt +++ b/TESTS/ref_files/mod_int_args.txt @@ -2,4 +2,4 @@ { "single_int": 10 -} +} diff --git a/TESTS/ref_files/mod_int_kwargs.txt b/TESTS/ref_files/mod_int_kwargs.txt index 61157a1..8ac9c25 100644 --- a/TESTS/ref_files/mod_int_kwargs.txt +++ b/TESTS/ref_files/mod_int_kwargs.txt @@ -2,4 +2,4 @@ { "single_int": 10 -} +} diff --git a/TESTS/ref_files/mod_list.txt b/TESTS/ref_files/mod_list.txt index 6f06c0c..4eda7b4 100644 --- a/TESTS/ref_files/mod_list.txt +++ b/TESTS/ref_files/mod_list.txt @@ -4,4 +4,4 @@ "single_list": [ null ] -} +} diff --git a/TESTS/ref_files/mod_list_args.txt b/TESTS/ref_files/mod_list_args.txt index 1938c8c..ab04d7c 100644 --- a/TESTS/ref_files/mod_list_args.txt +++ b/TESTS/ref_files/mod_list_args.txt @@ -6,4 +6,4 @@ 2, 3 ] -} +} diff --git a/TESTS/ref_files/mod_list_kwargs.txt b/TESTS/ref_files/mod_list_kwargs.txt index 3ad78da..2ae7d10 100644 --- a/TESTS/ref_files/mod_list_kwargs.txt +++ b/TESTS/ref_files/mod_list_kwargs.txt @@ -6,4 +6,4 @@ 2, 3 ] -} +} diff --git a/TESTS/ref_files/mod_multi.txt b/TESTS/ref_files/mod_multi.txt index ae2c2e1..39ee30a 100644 --- a/TESTS/ref_files/mod_multi.txt +++ b/TESTS/ref_files/mod_multi.txt @@ -17,4 +17,4 @@ ], "inp_str": "Six" } -} +} diff --git a/TESTS/ref_files/mod_multi_args.txt b/TESTS/ref_files/mod_multi_args.txt index e261baf..49dd9b4 100644 --- a/TESTS/ref_files/mod_multi_args.txt +++ b/TESTS/ref_files/mod_multi_args.txt @@ -17,4 +17,4 @@ ], "inp_str": "Seven" } -} +} diff --git a/TESTS/ref_files/mod_multi_kwargs.txt b/TESTS/ref_files/mod_multi_kwargs.txt index 2245225..a312538 100644 --- a/TESTS/ref_files/mod_multi_kwargs.txt +++ b/TESTS/ref_files/mod_multi_kwargs.txt @@ -17,4 +17,4 @@ ], "inp_str": "Seven" } -} +} diff --git a/TESTS/ref_files/mod_multi_mix1.txt b/TESTS/ref_files/mod_multi_mix1.txt index e870bea..a3778da 100644 --- a/TESTS/ref_files/mod_multi_mix1.txt +++ b/TESTS/ref_files/mod_multi_mix1.txt @@ -17,4 +17,4 @@ ], "inp_str": "Seven" } -} +} diff --git a/TESTS/ref_files/mod_multi_mix2.txt b/TESTS/ref_files/mod_multi_mix2.txt index ff6b672..4a86b06 100644 --- a/TESTS/ref_files/mod_multi_mix2.txt +++ b/TESTS/ref_files/mod_multi_mix2.txt @@ -17,4 +17,4 @@ ], "inp_str": "Seven" } -} +} diff --git a/TESTS/ref_files/mod_multi_mix3.txt b/TESTS/ref_files/mod_multi_mix3.txt index 15c5700..a1174bd 100644 --- a/TESTS/ref_files/mod_multi_mix3.txt +++ b/TESTS/ref_files/mod_multi_mix3.txt @@ -17,4 +17,4 @@ ], "inp_str": "Six" } -} +} diff --git a/TESTS/ref_files/mod_str.txt b/TESTS/ref_files/mod_str.txt index 38db3e4..66745cb 100644 --- a/TESTS/ref_files/mod_str.txt +++ b/TESTS/ref_files/mod_str.txt @@ -2,4 +2,4 @@ { "single_str": "None" -} +} diff --git a/TESTS/ref_files/mod_str_args.txt b/TESTS/ref_files/mod_str_args.txt index 5594303..64cdcc5 100644 --- a/TESTS/ref_files/mod_str_args.txt +++ b/TESTS/ref_files/mod_str_args.txt @@ -2,4 +2,4 @@ { "single_str": "hello" -} +} diff --git a/TESTS/ref_files/mod_str_kwargs.txt b/TESTS/ref_files/mod_str_kwargs.txt index 6639a60..b3a7b43 100644 --- a/TESTS/ref_files/mod_str_kwargs.txt +++ b/TESTS/ref_files/mod_str_kwargs.txt @@ -2,4 +2,4 @@ { "single_str": "hello" -} +} diff --git a/TESTS/test_max_call.py b/TESTS/test_max_call.py new file mode 100644 index 0000000..ecf492f --- /dev/null +++ b/TESTS/test_max_call.py @@ -0,0 +1,368 @@ +import pytest +from collections import OrderedDict +#single args import +from maximal_scripts.demo import demo +from maximal_scripts.a.aa.aa import AA +from maximal_scripts.a.ab.ab import AB +from maximal_scripts.b.ba.ba import BA +from maximal_scripts.b.bb.bb import BB + +demo_arg_vs_ret = [ + ("demo.py".split(), OrderedDict()), + ("demo.py -h".split(), OrderedDict()), + ("demo.py --help".split(), OrderedDict()), + ("demo.py maximal_scripts/demo.yml".split(), OrderedDict({ + "classes": { + "ret_a": { + "subclasses": { + "ret_aa": { + "sub_func": { + "ret_aaa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_aab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_aac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_aad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + }, + "ret_ab": { + "sub_func": { + "ret_aba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_abb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_abc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_abd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + } + }, + "ret_b": { + "subclasses": { + "ret_ba": { + "sub_func": { + "ret_baa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + }, + "ret_bb": { + "sub_func": { + "ret_bba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bbb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bbc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bbd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + } + } + } + } + ) + ), +("demo.py maximal_scripts/demo.json".split(), OrderedDict({ + "classes": { + "ret_a": { + "subclasses": { + "ret_aa": { + "sub_func": { + "ret_aaa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_aab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_aac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_aad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + }, + "ret_ab": { + "sub_func": { + "ret_aba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_abb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_abc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_abd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + } + }, + "ret_b": { + "subclasses": { + "ret_ba": { + "sub_func": { + "ret_baa": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bab": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bac": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bad": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + }, + "ret_bb": { + "sub_func": { + "ret_bba": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bbb": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bbc": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + }, + "ret_bbd": { + "k1": "v1", + "k2": "v2", + "k3": "v3" + } + } + } + } + } + } + } + ) + ) +] + +aa_arg_vs_ret = [ + ("demo.py".split(), OrderedDict()), + ("demo.py -h".split(), OrderedDict()), + ("demo.py --help".split(), OrderedDict()), +] + +ab_arg_vs_ret = [ + ("demo.py".split(), OrderedDict()), + ("demo.py -h".split(), OrderedDict()), + ("demo.py --help".split(), OrderedDict()), +] + +ba_arg_vs_ret = [ + ("demo.py".split(), OrderedDict()), + ("demo.py -h".split(), OrderedDict()), + ("demo.py --help".split(), OrderedDict()), +] + +bb_arg_vs_ret = [ + ("demo.py".split(), OrderedDict()), + ("demo.py -h".split(), OrderedDict()), + ("demo.py --help".split(), OrderedDict()), +] + +args_in = None +OBJ = None +returned = None + +@pytest.fixture(autouse = True, scope="function") +def fix_function(): + + global args_in + global OBJ + global returned + + yield + + assert(returned == OBJ.returned) + +########################################################################################################## +## vscaled_args +########################################################################################################## + +@pytest.mark.parametrize("arg, ret", demo_arg_vs_ret) +def test_demo_args(arg, ret): + + global args_in + global OBJ + global returned + + args_in = arg + OBJ = demo(args_in) + returned = ret + + print("") + if returned != OBJ.returned: + print(f"{args_in} : Expected({returned}) != Actual({OBJ.returned})") + else: + print(f"{args_in} : Expected({returned}) == Actual({OBJ.returned})") + print("") + +@pytest.mark.parametrize("arg, ret", aa_arg_vs_ret) +def test_aa_args(arg, ret): + + global args_in + global OBJ + global returned + + args_in = arg + OBJ = AA(args_in) + returned = ret + + print("") + if returned != OBJ.returned: + print(f"{args_in} : Expected({returned}) != Actual({OBJ.returned})") + else: + print(f"{args_in} : Expected({returned}) == Actual({OBJ.returned})") + print("") + +@pytest.mark.parametrize("arg, ret", ab_arg_vs_ret) +def test_ab_args(arg, ret): + + global args_in + global OBJ + global returned + + args_in = arg + OBJ = AB(args_in) + returned = ret + + print("") + if returned != OBJ.returned: + print(f"{args_in} : Expected({returned}) != Actual({OBJ.returned})") + else: + print(f"{args_in} : Expected({returned}) == Actual({OBJ.returned})") + print("") + +@pytest.mark.parametrize("arg, ret", ba_arg_vs_ret) +def test_ba_args(arg, ret): + + global args_in + global OBJ + global returned + + args_in = arg + OBJ = BA(args_in) + returned = ret + + print("") + if returned != OBJ.returned: + print(f"{args_in} : Expected({returned}) != Actual({OBJ.returned})") + else: + print(f"{args_in} : Expected({returned}) == Actual({OBJ.returned})") + print("") + +@pytest.mark.parametrize("arg, ret", bb_arg_vs_ret) +def test_bb_args(arg, ret): + + global args_in + global OBJ + global returned + + args_in = arg + OBJ = BB(args_in) + returned = ret + + print("") + if returned != OBJ.returned: + print(f"{args_in} : Expected({returned}) != Actual({OBJ.returned})") + else: + print(f"{args_in} : Expected({returned}) == Actual({OBJ.returned})") + print("") + diff --git a/TESTS/test_max_warn.py b/TESTS/test_max_warn.py new file mode 100644 index 0000000..4f3214c --- /dev/null +++ b/TESTS/test_max_warn.py @@ -0,0 +1,66 @@ + +import re +import json +from collections import OrderedDict +from maximal_scripts.demo import demo + +def test_file_not_found(): + + try: + obj = demo("demo.py dummy.yml".split()) + except FileNotFoundError as err: + print(str(err)) + assert str(err).endswith(('.yml', '.yaml', '.json')) + +def test_empty_yml(): + + obj = demo("demo.py maximal_scripts/empty.yml".split()) + assert obj.returned == OrderedDict() + +def test_none_yml(): + + try: + obj = demo("demo.py maximal_scripts/none.yml".split()) + except TypeError as err: + assert re.match("(.+) missing (.+) required positional arguments: (.+)", str(err)) + +def test_empty_json(): + + try: + obj = demo("demo.py maximal_scripts/empty.json".split()) + except SyntaxError as err: + print(str(err)) + assert str(err).endswith(('.yml', '.yaml', '.json')) + +def test_none_json(): + + obj = demo("demo.py maximal_scripts/none.json".split()) + assert obj.returned == OrderedDict() + +def test_err_yml(): + + try: + obj = demo("demo.py maximal_scripts/error.yml".split()) + except SyntaxError as err: + assert str(err).endswith(('.yml', '.yaml', '.json')) + +def test_func_err(): + + try: + obj = demo("demo.py maximal_scripts/func_err.yml".split()) + except Exception as err: + assert re.match(f"Undefined func names : (.+), try using defined func names (.+) instead", str(err)) + +def test_type_err1(): + + try: + obj = demo("demo.py maximal_scripts/type_err1.yml".split()) + except ValueError as err: + assert re.match("(.+) Expected '(.+)' value for '(.+)' in kwargs of method '(.+)', got '(.+)' of '(.+)' instead", str(err)) + +def test_type_err2(): + + try: + obj = demo("demo.py maximal_scripts/type_err2.yml".split()) + except Exception as err: + assert re.match("Unsupported argument data type : '(.+)', try using basic types \\(int, float, str, list, dict, bool\\) instead", str(err)) diff --git a/TESTS/test_min_call.py b/TESTS/test_min_call.py index 26f80ea..d43bd89 100644 --- a/TESTS/test_min_call.py +++ b/TESTS/test_min_call.py @@ -10,56 +10,56 @@ from minimal_scripts.basic_usage import multi_args int_arg_vs_ret = [ - ("basic_usage.py -h".split(), None), - ("basic_usage.py --help".split(), None), + ("basic_usage.py -h".split(), {}), + ("basic_usage.py --help".split(), {}), ("basic_usage.py".split(), 0), ("basic_usage.py 10".split(), 10), ("basic_usage.py -inp_int=10".split(), 10), ] float_arg_vs_ret = [ - ("basic_usage.py -h".split(), None), - ("basic_usage.py --help".split(), None), + ("basic_usage.py -h".split(), {}), + ("basic_usage.py --help".split(), {}), ("basic_usage.py".split(), 0.0), ("basic_usage.py 10.0".split(), 10.0), ("basic_usage.py -inp_float=10.0".split(), 10.0), ] str_arg_vs_ret = [ - ("basic_usage.py -h".split(), None), - ("basic_usage.py --help".split(), None), + ("basic_usage.py -h".split(), {}), + ("basic_usage.py --help".split(), {}), ("basic_usage.py".split(), "None"), ("basic_usage.py Empty".split(), 'Empty'), ("basic_usage.py -inp_str=Empty".split(), 'Empty'), ] list_arg_vs_ret = [ - ("basic_usage.py -h".split(), None), - ("basic_usage.py --help".split(), None), + ("basic_usage.py -h".split(), {}), + ("basic_usage.py --help".split(), {}), ("basic_usage.py".split(), [None]), ("basic_usage.py ['Empty']".split(), ['Empty']), ("basic_usage.py -inp_list=['Empty']".split(), ['Empty']), ] dict_arg_vs_ret = [ - ("basic_usage.py -h".split(), None), - ("basic_usage.py --help".split(), None), + ("basic_usage.py -h".split(), {}), + ("basic_usage.py --help".split(), {}), ("basic_usage.py".split(), {None:None}), ("basic_usage.py {'Empty':'Empty'}".split(), {'Empty':'Empty'}), ("basic_usage.py -inp_dict={'Empty':'Empty'}".split(), {'Empty':'Empty'}), ] bool_arg_vs_ret = [ - ("basic_usage.py -h".split(), None), - ("basic_usage.py --help".split(), None), + ("basic_usage.py -h".split(), {}), + ("basic_usage.py --help".split(), {}), ("basic_usage.py".split(), False), ("basic_usage.py True".split(), True), ("basic_usage.py -inp_bool=True".split(), True), ] multi_arg_vs_ret = [ - ("basic_usage.py -h".split(), None), - ("basic_usage.py --help".split(), None), + ("basic_usage.py -h".split(), {}), + ("basic_usage.py --help".split(), {}), ("basic_usage.py".split(), { 'inp_int': 6, 'inp_float': 6.0, diff --git a/TESTS/test_min_warn.py b/TESTS/test_min_warn.py index ffca46f..485e685 100644 --- a/TESTS/test_min_warn.py +++ b/TESTS/test_min_warn.py @@ -1,5 +1,6 @@ import re +from collections import OrderedDict from minimal_scripts.basic_usage import warn_ret_type from minimal_scripts.basic_usage import warn_wo_ret_typ_def from minimal_scripts.basic_usage import warn_no_support_typ_arg @@ -30,7 +31,7 @@ def test_warn_ret_type3(): def test_warn_wo_ret_typ_def1(): obj = warn_wo_ret_typ_def("basic_usage.py --help".split()) - assert(None == obj.returned) + assert(OrderedDict() == obj.returned) print(obj.returned) def test_warn_wo_ret_typ_def2(): diff --git a/TESTS/test_mod_call.py b/TESTS/test_mod_call.py index e5cbd23..cac4df3 100644 --- a/TESTS/test_mod_call.py +++ b/TESTS/test_mod_call.py @@ -1,12 +1,12 @@ import pytest - +from collections import OrderedDict #single args import from moderate_scripts.basic_usage import vscaled_args multi_arg_vs_ret = [ - ("basic_usgae.py".split(), None), - ("basic_usage.py -h".split(), None), - ("basic_usage.py --help".split(), None), + ("basic_usage.py".split(), OrderedDict()), + ("basic_usage.py -h".split(), OrderedDict()), + ("basic_usage.py --help".split(), OrderedDict()), ("basic_usage.py ~single_bool True ~single_dict {'Empty':'Empty'} ~single_float 10.0 ~single_int 10 ~single_list ['Empty'] ~single_str Empty".split(), { "single_bool": True, "single_dict": { diff --git a/setup.py b/setup.py index b1c467d..096ffcb 100644 --- a/setup.py +++ b/setup.py @@ -5,9 +5,9 @@ setup( name="py4cli", - version="0.0.6", + version="0.0.8", description="python for command line interface development", - py_modules=["py4cli/minimal", "py4cli/moderate"], + py_modules=["py4cli/minimal", "py4cli/moderate", "py4cli/maximal"], package_dir={"": "SRCS"}, long_description=long_description, long_description_content_type="text/markdown", @@ -23,6 +23,7 @@ install_requires = [ "blessings ~= 1.7", + "PyYAML~=6.0.1" ], extras_require = { diff --git a/test_reqs.txt b/test_reqs.txt index b2720d1..d3ae5b2 100644 --- a/test_reqs.txt +++ b/test_reqs.txt @@ -3,4 +3,5 @@ pytest==6.2.5 pytest-reporter==0.5.2 pytest-reporter-html1==0.8.2 python-dateutil==2.8.2 -pandas \ No newline at end of file +pandas +PyYAML \ No newline at end of file