from unittest import TestCase
from pointfree import *

def kwonly_pure_func(a, b, *, c):
    return a + b + c

@partial
def kwonly_func(a, b, *, c):
    return a + b + c

class KwOnlyArgsCase(TestCase):
    def testNormalApplication(self):
        self.assertEqual(kwonly_func(1,2,c=3), 6)

    def testPartialApplication(self):
        self.assertEqual(kwonly_func(1)(2)(c=3), 6)
        self.assertEqual(kwonly_func(1,2)(c=3), 6)
        self.assertEqual(kwonly_func(1)(2,c=3), 6)
        self.assertEqual(kwonly_func(c=3)(1,2), 6)
        self.assertEqual(kwonly_func(c=3)(1)(2), 6)

    def testKeywordOnlyApplication(self):
        self.assertRaises(TypeError, lambda *a: kwonly_func(1,2,3))

from unittest import TestCase
from pointfree import *

def kwonly_pure_func(a, b, *, c):
    return a + b + c

@partial
def kwonly_func(a, b, *, c):
    return a + b + c

@partial
def kwonly_defaults_func(a, b, *, c=3):
    return a + b + c

@partial
def kwonly_varkw_func(a, b, *, c, **kwargs):
    return (a + b + c, kwargs)

class KwOnlyArgsCase(TestCase):
    def testNormalApplication(self):
        self.assertEqual(kwonly_func(1,2,c=3), 6)

    def testPartialApplication(self):
        self.assertEqual(kwonly_func(1)(2)(c=3), 6)
        self.assertEqual(kwonly_func(1,2)(c=3), 6)
        self.assertEqual(kwonly_func(1)(2,c=3), 6)
        self.assertEqual(kwonly_func(c=3)(1,2), 6)
        self.assertEqual(kwonly_func(c=3)(1)(2), 6)
        self.assertEqual(kwonly_func(a=1)(b=2)(c=3), 6)

    def testTooManyPositionalArguments(self):
        self.assertRaises(TypeError, lambda: kwonly_func(1,2,3))

    def testTooManyKeywordArguments(self):
        self.assertRaises(TypeError, lambda: kwonly_func(d=1))

class KwOnlyDefaultsCase(TestCase):
    def testNormalApplication(self):
        self.assertEqual(kwonly_defaults_func(1,2,c=4), 7)

    def testDefaultApplication(self):
        self.assertEqual(kwonly_defaults_func(1,2), 6)

class KwOnlyAndVarKargsCase(TestCase):
    def testNormalApplication(self):
        value, kwargs = kwonly_varkw_func(1,2,c=3,d=4,e=5)
        self.assertEqual(value, 6)
        self.assertDictEqual(kwargs, {'d': 4, 'e': 5})

Add tests for more keyword-only arguments behavior
Add tests for more keyword-only arguments behavior

Test for handling of default keyword-only argument values and mixing
keyword-only arguments with variable keyword arguments lists.

  from unittest import TestCase
  from pointfree import *
  
  def kwonly_pure_func(a, b, *, c):
      return a + b + c
  
  @partial
  def kwonly_func(a, b, *, c):
      return a + b + c
+ 
+ @partial
+ def kwonly_defaults_func(a, b, *, c=3):
+     return a + b + c
+ 
+ @partial
+ def kwonly_varkw_func(a, b, *, c, **kwargs):
+     return (a + b + c, kwargs)
  
  class KwOnlyArgsCase(TestCase):
      def testNormalApplication(self):
          self.assertEqual(kwonly_func(1,2,c=3), 6)
  
      def testPartialApplication(self):
          self.assertEqual(kwonly_func(1)(2)(c=3), 6)
          self.assertEqual(kwonly_func(1,2)(c=3), 6)
          self.assertEqual(kwonly_func(1)(2,c=3), 6)
          self.assertEqual(kwonly_func(c=3)(1,2), 6)
          self.assertEqual(kwonly_func(c=3)(1)(2), 6)
+         self.assertEqual(kwonly_func(a=1)(b=2)(c=3), 6)
  
-     def testKeywordOnlyApplication(self):
+     def testTooManyPositionalArguments(self):
-         self.assertRaises(TypeError, lambda *a: kwonly_func(1,2,3))
+         self.assertRaises(TypeError, lambda: kwonly_func(1,2,3))
  
+     def testTooManyKeywordArguments(self):
+         self.assertRaises(TypeError, lambda: kwonly_func(d=1))
+ 
+ class KwOnlyDefaultsCase(TestCase):
+     def testNormalApplication(self):
+         self.assertEqual(kwonly_defaults_func(1,2,c=4), 7)
+ 
+     def testDefaultApplication(self):
+         self.assertEqual(kwonly_defaults_func(1,2), 6)
+ 
+ class KwOnlyAndVarKargsCase(TestCase):
+     def testNormalApplication(self):
+         value, kwargs = kwonly_varkw_func(1,2,c=3,d=4,e=5)
+         self.assertEqual(value, 6)
+         self.assertDictEqual(kwargs, {'d': 4, 'e': 5})
+ 
Add tests for more keyword-only arguments behavior
## Code Before:
from unittest import TestCase
from pointfree import *

def kwonly_pure_func(a, b, *, c):
    return a + b + c

@partial
def kwonly_func(a, b, *, c):
    return a + b + c

class KwOnlyArgsCase(TestCase):
    def testNormalApplication(self):
        self.assertEqual(kwonly_func(1,2,c=3), 6)

    def testPartialApplication(self):
        self.assertEqual(kwonly_func(1)(2)(c=3), 6)
        self.assertEqual(kwonly_func(1,2)(c=3), 6)
        self.assertEqual(kwonly_func(1)(2,c=3), 6)
        self.assertEqual(kwonly_func(c=3)(1,2), 6)
        self.assertEqual(kwonly_func(c=3)(1)(2), 6)

    def testKeywordOnlyApplication(self):
        self.assertRaises(TypeError, lambda *a: kwonly_func(1,2,3))

## Instruction:
Add tests for more keyword-only arguments behavior
## Code After:
from unittest import TestCase
from pointfree import *

def kwonly_pure_func(a, b, *, c):
    return a + b + c

@partial
def kwonly_func(a, b, *, c):
    return a + b + c

@partial
def kwonly_defaults_func(a, b, *, c=3):
    return a + b + c

@partial
def kwonly_varkw_func(a, b, *, c, **kwargs):
    return (a + b + c, kwargs)

class KwOnlyArgsCase(TestCase):
    def testNormalApplication(self):
        self.assertEqual(kwonly_func(1,2,c=3), 6)

    def testPartialApplication(self):
        self.assertEqual(kwonly_func(1)(2)(c=3), 6)
        self.assertEqual(kwonly_func(1,2)(c=3), 6)
        self.assertEqual(kwonly_func(1)(2,c=3), 6)
        self.assertEqual(kwonly_func(c=3)(1,2), 6)
        self.assertEqual(kwonly_func(c=3)(1)(2), 6)
        self.assertEqual(kwonly_func(a=1)(b=2)(c=3), 6)

    def testTooManyPositionalArguments(self):
        self.assertRaises(TypeError, lambda: kwonly_func(1,2,3))

    def testTooManyKeywordArguments(self):
        self.assertRaises(TypeError, lambda: kwonly_func(d=1))

class KwOnlyDefaultsCase(TestCase):
    def testNormalApplication(self):
        self.assertEqual(kwonly_defaults_func(1,2,c=4), 7)

    def testDefaultApplication(self):
        self.assertEqual(kwonly_defaults_func(1,2), 6)

class KwOnlyAndVarKargsCase(TestCase):
    def testNormalApplication(self):
        value, kwargs = kwonly_varkw_func(1,2,c=3,d=4,e=5)
        self.assertEqual(value, 6)
        self.assertDictEqual(kwargs, {'d': 4, 'e': 5})
