def test_not_equals(self): cases = [ NEA( 'unexpected driver type', expected=sut.matches_command( sut.equals_shell_command_driver( CommandDriverForShell('command')), asrt.equals(['arg'])), actual=Command(CommandDriverForSystemProgram('command'), ['arg']), ), NEA( 'unexpected driver data', expected=sut.matches_command( sut.equals_system_program_command_driver( CommandDriverForSystemProgram('expected')), asrt.equals([])), actual=Command(CommandDriverForSystemProgram('unexpected'), []), ), NEA( 'unexpected argument', expected=sut.matches_command( sut.equals_system_program_command_driver( CommandDriverForSystemProgram('command')), asrt.equals(['expected'])), actual=Command(CommandDriverForSystemProgram('command'), ['expected', 'unexpected']), ), ] for case in cases: with self.subTest(case.name): assert_that_assertion_fails(case.expected, case.actual)
def test_equals(self): cases = [ NEA( 'without arguments', expected=CommandDriverForSystemProgram('expected program'), actual=CommandDriverForSystemProgram('expected program'), ), ] for case in cases: assertion = sut.equals_system_program_command_driver(case.expected) with self.subTest(case.name): assertion.apply_without_message(self, case.actual)
def test_system_program(self): # ARRANGE # program_name = 'program_name' cases = [ NIE('without arguments', expected_value=[program_name], input_value=[], ), NIE('with arguments', expected_value=[program_name, 'arg1', 'arg2'], input_value=['arg1', 'arg2'], ), ] for case in cases: with self.subTest(case.name): command = Command(CommandDriverForSystemProgram(program_name), case.input_value) # ACT # actual = self.factory.make(command) # ASSERT # self.assertFalse(actual.is_shell) self.assertIsInstance(actual.arg_list_or_str, list) self.assertEqual(case.expected_value, actual.arg_list_or_str)
def equals_system_program_command(program: str, arguments: List[str]) -> Assertion[Command]: return matches_command( equals_system_program_command_driver( CommandDriverForSystemProgram(program)), asrt.equals(arguments), )
def test_not_equals(self): cases = [ NEA( 'unexpected program', expected=CommandDriverForSystemProgram('expected program'), actual=CommandDriverForSystemProgram('actual program'), ), NEA( 'unexpected command type', expected=CommandDriverForSystemProgram('expected'), actual=CommandDriverForExecutableFile( new_primitive(pathlib.Path('expected'))), ), ] for case in cases: assertion = sut.equals_system_program_command_driver(case.expected) with self.subTest(case.name): assert_that_assertion_fails(assertion, case.actual)
def test_equals(self): cases = [ NEA( '', expected=sut.equals_system_program_command( 'expected', ['arg']), actual=Command(CommandDriverForSystemProgram('expected'), ['arg']), ), ] for case in cases: with self.subTest(case.name): case.expected.apply_without_message(self, case.actual)
def test_equals(self): cases = [ NEA( 'shell', expected=sut.matches_command( sut.equals_shell_command_driver( CommandDriverForShell('command line')), asrt.equals(['arg'])), actual=Command(CommandDriverForShell('command line'), ['arg']), ), NEA( 'without arguments', expected=sut.matches_command( sut.equals_system_program_command_driver( CommandDriverForSystemProgram('program')), asrt.equals([])), actual=Command(CommandDriverForSystemProgram('program'), []), ), ] for case in cases: with self.subTest(case.name): case.expected.apply_without_message(self, case.actual)
def test_not_equals(self): cases = [ NEA( 'unexpected command line', expected=sut.equals_shell_command('expected', []), actual=Command(CommandDriverForShell('unExpected'), []), ), NEA( 'unexpected driver type', expected=sut.equals_shell_command('expected', []), actual=Command(CommandDriverForSystemProgram('expected'), []), ), ] for case in cases: with self.subTest(case.name): assert_that_assertion_fails(case.expected, case.actual)
def test_not_equals(self): cases = [ NEA( 'unexpected command string', expected=CommandDriverForShell('expected'), actual=CommandDriverForShell('actual'), ), NEA( 'unexpected command type', expected=CommandDriverForShell('expected'), actual=CommandDriverForSystemProgram('expected'), ), ] for case in cases: assertion = sut.equals_shell_command_driver(case.expected) with self.subTest(case.name): assert_that_assertion_fails(assertion, case.actual)
def test_not_equals(self): cases = [ NEA( 'unexpected file', expected=sut.equals_executable_file_command( new_primitive(pathlib.Path('expected')), []), actual=Command( CommandDriverForExecutableFile( new_primitive(pathlib.Path('unExpected'))), []), ), NEA( 'unexpected driver type', expected=sut.equals_executable_file_command( new_primitive(pathlib.Path('expected')), []), actual=Command(CommandDriverForSystemProgram('expected'), []), ), ] for case in cases: with self.subTest(case.name): assert_that_assertion_fails(case.expected, case.actual)