'Test invalid arguments to spawnProcess: arguments and environment
must only contains string or unicode, and not null bytes.'

def test_wrongArguments(self):

    p = protocol.ProcessProtocol()
    badEnvs = [{'foo': 2}, {'foo': 'egg\x00a'}, {3: 'bar'}, {'bar\x00foo': 'bar'}]
    badArgs = [[pyExe, 2], 'spam', [pyExe, 'foo\x00bar']]
    badUnicode = u'\u2603'
    try:
        badUnicode.encode(sys.getfilesystemencoding())
    except UnicodeEncodeError:
        badEnvs.append({badUnicode: 'value    for    bad    unicode    key'})
        badEnvs.append({'key    for    bad    unicode    value': badUnicode})
        badArgs.append([pyExe, badUnicode])
    else:
        pass
    for env in badEnvs:
        self.assertRaises(TypeError, reactor.spawnProcess, p, pyExe, [pyExe, '-c', ''], env=env)
    for args in badArgs:
        self.assertRaises(TypeError, reactor.spawnProcess, p, pyExe, args, env=None)
