def test_6(self) -> None: expected_output = "s.startswith(r'abc')" call = ast.parse(expected_output).body[0].value prop = Property( identifier=call.func, property_arguments=[PropertyArgument(call.args, [])], left_function_call=None, var_id='s', is_routine=True, var_is_caller=True ) self.assertEqual(expected_output, property_to_string(prop))
def test_1(self) -> None: expected_output = "len(lst) >= (5)" compare = ast.parse(expected_output).body[0].value prop = Property( identifier=compare.ops[0], property_arguments=[PropertyArgument((comparator, ), []) for comparator in compare.comparators], left_function_call='len', var_id='lst', is_routine=False, var_is_caller=False ) self.assertEqual(expected_output, property_to_string(prop))
def test_4(self) -> None: expected_output = "s.isnumeric()" call = ast.parse(expected_output).body[0].value prop = Property( identifier=call.func, property_arguments=[], left_function_call=None, var_id='s', is_routine=True, var_is_caller=True ) self.assertEqual(expected_output, property_to_string(prop))
def test_1(self) -> None: test_input = "x >= 5" compare = ast.parse(test_input).body[0].value prop_input = Property( identifier=compare.ops[0], property_arguments=[PropertyArgument((comparator, ), []) for comparator in compare.comparators], left_function_call=None, var_id='x', is_routine=False, var_is_caller=False ) expected_output_incremented = "({(6,)}, set())" prop_input_incremented = increment_property(prop_input) self.assertEqual(expected_output_incremented, property_to_string(prop_input_incremented))