/*
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2015  
 */
package com.ibm.streamsx.topology.test.splpy;

import static org.junit.Assert.assertFalse;

import java.io.File;
import java.util.Arrays;
import java.util.List;

import org.junit.Test;

import com.ibm.streamsx.topology.test.TestTopology;

public class PythonInvalidFunctionalOperatorsTest extends TestTopology {
    
    @Test
    public void testInvalidStyle() throws Exception {
        String[] code = {
                "@spl.map(style='fred')\n",
                "def inv1(*tuple):\n",
                "  pass\n"
        };
        _testInvalidToolkit(Arrays.asList(code));
    }
    @Test
    public void testMismatchedStyle1() throws Exception {
        String[] code = {
                "@spl.map(style='name')\n",
                "def inv2(*tuple):\n",
                "  pass\n"
        };
        _testInvalidToolkit(Arrays.asList(code));
    }
    @Test
    public void testKwargsAndPositional() throws Exception {
        String[] code = {
                "@spl.map(style='positional')\n",
                "def inv3(a,b,c,**tuple):\n",
                "  pass\n"
        };
        _testInvalidToolkit(Arrays.asList(code));
    }
    @Test
    public void testPositionalWithKeywordOnly() throws Exception {
        String[] code = {
                "@spl.map(style='positional')\n",
                "def inv4(a,b,c,**tuple,d):\n",
                "  pass\n"
        };
        _testInvalidToolkit(Arrays.asList(code));
    }
    
    public static void _testInvalidToolkit(String[] code) throws Exception {        
        _testInvalidToolkit(Arrays.asList(code));
    }    
    
    public static void _testInvalidToolkit(List<String> code) throws Exception {        
        File tkdir = PythonExtractTest.createPyTk(PythonExtractTest.NS, code);
        try {
             assertFalse(PythonExtractTest.extract(tkdir, false) == 0); 
        } finally {
            tkdir.delete();
        }
    }
}

@@ -1506,24 +1506,1310 @@
 %0A    %7D%0A    %0A
+    @Test%0A    public void testOpParamNonAsciiIdentifier() throws Exception %7B%0A        String%5B%5D code = %7B%0A                %22@spl.map()%5Cn%22,%0A                %22class op1(object):%5Cn%22,%0A                %22  def __init__(self, na%C3%AFve):%5Cn%22,%0A                %22     pass%5Cn%22%0A        %7D;%0A        _testInvalidToolkit(Arrays.asList(code));%0A    %7D    %0A    %0A    @Test%0A    public void testOpParamKeyword() throws Exception %7B%0A        String%5B%5D code = %7B%0A                %22@spl.map()%5Cn%22,%0A                %22class op2(object):%5Cn%22,%0A                %22  def __init__(self, stream):%5Cn%22,%0A                %22     pass%5Cn%22%0A        %7D;%0A        _testInvalidToolkit(Arrays.asList(code));%0A    %7D%0A    %0A    @Test%0A    public void testOpParamSuppress() throws Exception %7B%0A        String%5B%5D code = %7B%0A                %22@spl.map()%5Cn%22,%0A                %22class op3(object):%5Cn%22,%0A                %22  def __init__(self, suppress):%5Cn%22,%0A                %22     pass%5Cn%22%0A        %7D;%0A        _testInvalidToolkit(Arrays.asList(code));%0A    %7D%0A    %0A    @Test%0A    public void testOpParamInclude() throws Exception %7B%0A        String%5B%5D code = %7B%0A                %22@spl.map()%5Cn%22,%0A                %22class op4(object):%5Cn%22,%0A                %22  def __init__(self, include):%5Cn%22,%0A                %22     pass%5Cn%22%0A        %7D;%0A        _testInvalidToolkit(Arrays.asList(code));%0A    %7D%0A    %0A
     public s

Add tests for invalid operator parameters