prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  math CheckPrime is wrong
  The current implementation doesn't support:
  
  * Negative values, -1 is not a prime number. Current implementation raise a TypeError due to `math.sqrt` on negative values.
  
  The current implementation return the wrong value for:
  
  * 0, 0 doesn't have any divider, primes must have two.
  * 1, 1 just have one divider, primes must have two.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `maths/PrimeCheck.py`
  Content:
  ```
  1 import math
  2 def primeCheck(number):
  3     if number % 2 == 0 and number > 2: 
  4         return False
  5     return all(number % i for i in range(3, int(math.sqrt(number)) + 1, 2))
  6 
  7 def main():
  8     print(primeCheck(37))
  9     print(primeCheck(100))
  10     print(primeCheck(77))
  11 
  12 if __name__ == '__main__':
  13 	main()
  14
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/maths/PrimeCheck.py b/maths/PrimeCheck.py
  --- a/maths/PrimeCheck.py
  +++ b/maths/PrimeCheck.py
  @@ -1,13 +1,54 @@
   import math
  +import unittest
  +
  +
   def primeCheck(number):
  -    if number % 2 == 0 and number > 2: 
  +    """
  +    A number is prime if it has exactly two dividers: 1 and itself.
  +    """
  +    if number < 2:
  +        # Negatives, 0 and 1 are not primes
           return False
  -    return all(number % i for i in range(3, int(math.sqrt(number)) + 1, 2))
  +    if number < 4:
  +        # 2 and 3 are primes
  +        return True
  +    if number % 2 == 0:
  +        # Even values are not primes
  +        return False
  +
  +    # Except 2, all primes are odd. If any odd value divide
  +    # the number, then that number is not prime.
  +    odd_numbers = range(3, int(math.sqrt(number)) + 1, 2)
  +    return not any(number % i == 0 for i in odd_numbers)
  +
  +
  +class Test(unittest.TestCase):
  +    def test_primes(self):
  +        self.assertTrue(primeCheck(2))
  +        self.assertTrue(primeCheck(3))
  +        self.assertTrue(primeCheck(5))
  +        self.assertTrue(primeCheck(7))
  +        self.assertTrue(primeCheck(11))
  +        self.assertTrue(primeCheck(13))
  +        self.assertTrue(primeCheck(17))
  +        self.assertTrue(primeCheck(19))
  +        self.assertTrue(primeCheck(23))
  +        self.assertTrue(primeCheck(29))
  +
  +    def test_not_primes(self):
  +        self.assertFalse(primeCheck(-19),
  +                "Negative numbers are not prime.")
  +        self.assertFalse(primeCheck(0),
  +                "Zero doesn't have any divider, primes must have two")
  +        self.assertFalse(primeCheck(1),
  +                "One just have 1 divider, primes must have two.")
  +        self.assertFalse(primeCheck(2 * 2))
  +        self.assertFalse(primeCheck(2 * 3))
  +        self.assertFalse(primeCheck(3 * 3))
  +        self.assertFalse(primeCheck(3 * 5))
  +        self.assertFalse(primeCheck(3 * 5 * 7))
   
  -def main():
  -    print(primeCheck(37))
  -    print(primeCheck(100))
  -    print(primeCheck(77))
   
   if __name__ == '__main__':
  -	main()
  +    unittest.main()
  +
  
verification_info: {"golden_diff": "diff --git a/maths/PrimeCheck.py b/maths/PrimeCheck.py\n--- a/maths/PrimeCheck.py\n+++ b/maths/PrimeCheck.py\n@@ -1,13 +1,54 @@\n import math\n+import unittest\n+\n+\n def primeCheck(number):\n-    if number % 2 == 0 and number > 2: \n+    \"\"\"\n+    A number is prime if it has exactly two dividers: 1 and itself.\n+    \"\"\"\n+    if number < 2:\n+        # Negatives, 0 and 1 are not primes\n         return False\n-    return all(number % i for i in range(3, int(math.sqrt(number)) + 1, 2))\n+    if number < 4:\n+        # 2 and 3 are primes\n+        return True\n+    if number % 2 == 0:\n+        # Even values are not primes\n+        return False\n+\n+    # Except 2, all primes are odd. If any odd value divide\n+    # the number, then that number is not prime.\n+    odd_numbers = range(3, int(math.sqrt(number)) + 1, 2)\n+    return not any(number % i == 0 for i in odd_numbers)\n+\n+\n+class Test(unittest.TestCase):\n+    def test_primes(self):\n+        self.assertTrue(primeCheck(2))\n+        self.assertTrue(primeCheck(3))\n+        self.assertTrue(primeCheck(5))\n+        self.assertTrue(primeCheck(7))\n+        self.assertTrue(primeCheck(11))\n+        self.assertTrue(primeCheck(13))\n+        self.assertTrue(primeCheck(17))\n+        self.assertTrue(primeCheck(19))\n+        self.assertTrue(primeCheck(23))\n+        self.assertTrue(primeCheck(29))\n+\n+    def test_not_primes(self):\n+        self.assertFalse(primeCheck(-19),\n+                \"Negative numbers are not prime.\")\n+        self.assertFalse(primeCheck(0),\n+                \"Zero doesn't have any divider, primes must have two\")\n+        self.assertFalse(primeCheck(1),\n+                \"One just have 1 divider, primes must have two.\")\n+        self.assertFalse(primeCheck(2 * 2))\n+        self.assertFalse(primeCheck(2 * 3))\n+        self.assertFalse(primeCheck(3 * 3))\n+        self.assertFalse(primeCheck(3 * 5))\n+        self.assertFalse(primeCheck(3 * 5 * 7))\n \n-def main():\n-    print(primeCheck(37))\n-    print(primeCheck(100))\n-    print(primeCheck(77))\n \n if __name__ == '__main__':\n-\tmain()\n+    unittest.main()\n+\n", "issue": "math CheckPrime is wrong\nThe current implementation doesn't support:\r\n\r\n* Negative values, -1 is not a prime number. Current implementation raise a TypeError due to `math.sqrt` on negative values.\r\n\r\nThe current implementation return the wrong value for:\r\n\r\n* 0, 0 doesn't have any divider, primes must have two.\r\n* 1, 1 just have one divider, primes must have two.\n", "before_files": [{"content": "import math\ndef primeCheck(number):\n    if number % 2 == 0 and number > 2: \n        return False\n    return all(number % i for i in range(3, int(math.sqrt(number)) + 1, 2))\n\ndef main():\n    print(primeCheck(37))\n    print(primeCheck(100))\n    print(primeCheck(77))\n\nif __name__ == '__main__':\n\tmain()\n", "path": "maths/PrimeCheck.py"}], "after_files": [{"content": "import math\nimport unittest\n\n\ndef primeCheck(number):\n    \"\"\"\n    A number is prime if it has exactly two dividers: 1 and itself.\n    \"\"\"\n    if number < 2:\n        # Negatives, 0 and 1 are not primes\n        return False\n    if number < 4:\n        # 2 and 3 are primes\n        return True\n    if number % 2 == 0:\n        # Even values are not primes\n        return False\n\n    # Except 2, all primes are odd. If any odd value divide\n    # the number, then that number is not prime.\n    odd_numbers = range(3, int(math.sqrt(number)) + 1, 2)\n    return not any(number % i == 0 for i in odd_numbers)\n\n\nclass Test(unittest.TestCase):\n    def test_primes(self):\n        self.assertTrue(primeCheck(2))\n        self.assertTrue(primeCheck(3))\n        self.assertTrue(primeCheck(5))\n        self.assertTrue(primeCheck(7))\n        self.assertTrue(primeCheck(11))\n        self.assertTrue(primeCheck(13))\n        self.assertTrue(primeCheck(17))\n        self.assertTrue(primeCheck(19))\n        self.assertTrue(primeCheck(23))\n        self.assertTrue(primeCheck(29))\n\n    def test_not_primes(self):\n        self.assertFalse(primeCheck(-19),\n                \"Negative numbers are not prime.\")\n        self.assertFalse(primeCheck(0),\n                \"Zero doesn't have any divider, primes must have two\")\n        self.assertFalse(primeCheck(1),\n                \"One just have 1 divider, primes must have two.\")\n        self.assertFalse(primeCheck(2 * 2))\n        self.assertFalse(primeCheck(2 * 3))\n        self.assertFalse(primeCheck(3 * 3))\n        self.assertFalse(primeCheck(3 * 5))\n        self.assertFalse(primeCheck(3 * 5 * 7))\n\n\nif __name__ == '__main__':\n    unittest.main()\n\n", "path": "maths/PrimeCheck.py"}]}