Repository: microsoft/kiota (csharp)

Issue:
Cannot retrieve cell value when column or row are zero
### Describe the bug

You cannot retrieve a cell value when row or column are zero since there is a `if not` check that prevents the call to go thru.

```    def cell_with_row_with_column(self,column: int, row: int) -> CellWithRowWithColumnRequestBuilder:
        """
        Provides operations to call the cell method.
        param column: Usage: column={column}
        param row: Usage: row={row}
        Returns: CellWithRowWithColumnRequestBuilder
        """
        if not column:
            raise TypeError("column cannot be null.")
        if not row:
            raise TypeError("row cannot be null.")
        from .cell_with_row_with_column.cell_with_row_with_column_request_builder import CellWithRowWithColumnRequestBuilder

        return CellWithRowWithColumnRequestBuilder(self.request_adapter, self.path_parameters, column, row)
```

### Expected behavior

The call should support zeros since indexing of columns and rows are zero-based.

### How to reproduce

```client.drives.by_drive_id(drive_id).items.by_drive_item_id(item_id).workbook.worksheets.by_workbook_worksheet_id(worksheet_id).cell_with_row_with_column(0, 0).get()```

### SDK Version

1.4.0

### Latest version known to work for scenario above?

_No response_

### Known Workarounds

None

### Debug output

```self = <msgraph.generated.drives.item.items.item.workbook.worksheets.item.workbook_worksheet_item_request_builder.WorkbookWorksheetItemRequestBuilder object at 0x10a1ec810>
column = 23, row = 0

    def cell_with_row_with_column(self,column: int, row: int) -> CellWithRowWithColumnRequestBuilder:
        """
        Provides operations to call the cell method.
        param column: Usage: column={column}
        param row: Usage: row={row}
        Returns: CellWithRowWithColumnRequestBuilder
        """
        if not column:
            raise TypeError("column cannot be null.")
        if not row:
>           raise TypeError("row cannot be null.")
E           TypeError: row cannot be null.
```

### Configuration

OS: macOS Sonoma
Arch: ARM64

### Other information

_No response_

Pull request description:
Closes https://github.com/microsoftgraph/msgraph-sdk-python/issues/795


Note that

`if not column` is falsy even if colum exists and is zero, using i`f column is None` will check that column is null in a better way in this case:


The generated code behavior is now adjusted from
```python
if not body:
    raise TypeError("body cannot be null.")
request_info = self.to_patch_request_information(
        body, request_configuration
    )

```

To
```python

if body is None:
    raise TypeError("body cannot be null.")
request_info = self.to_patch_request_information(
        body, request_configuration
    )
```


And the same applies in all areas including drive items

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 447d71f76b..521b32331d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Added
 
-- Adds generation of default 'color.png`and`outline.png` files when generating plugins. [#4993](https://github.com/microsoft/kiota/issues/4993)
+- Adds generation of default `color.png` and `outline.png` files when generating plugins. [#4993](https://github.com/microsoft/kiota/issues/4993)
 
 ### Changed
 
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Exclude the `x-openai-isConsequential` extension from cleanup. [#4962](https://github.com/microsoft/kiota/issues/4962)
 - Fixed file name and namespace sanitization when generating plugins. [#5019](https://github.com/microsoft/kiota/issues/5019)
 - Added TypeScript typecheck suppression to generated method prototype, where anused arguments can cause build fail in projects which use `noUnusedLocals: true` compiler option. [#5095](https://github.com/microsoft/kiota/issues/5095)
+- Fixed a bug where defensive programming would consider some default values as invalid in Python.
 
 ## [1.16.0] - 2024-07-05
 
diff --git a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs
index 0b5025485b..17f082d352 100644
--- a/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs
+++ b/src/Kiota.Builder/Writers/Python/CodeMethodWriter.cs
@@ -43,7 +43,7 @@ public override void WriteCodeElement(CodeMethod codeElement, LanguageWriter wri
             foreach (var parameter in codeElement.Parameters.Where(static x => !x.Optional).OrderBy(static x => x.Name))
             {
                 var parameterName = parameter.Name;
-                writer.StartBlock($"if not {parameterName}:");
+                writer.StartBlock($"if {parameterName} is None:");
                 writer.WriteLine($"raise TypeError(\"{parameterName} cannot be null.\")");
                 writer.DecreaseIndent();
             }


Test patch:
diff --git a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs
index 4bb0166050..2d3516a271 100644
--- a/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs
+++ b/tests/Kiota.Builder.Tests/Writers/Python/CodeMethodWriterTests.cs
@@ -2086,7 +2086,7 @@ public void WritesNameMapperMethod()
         });
         writer.Write(method);
         var result = tw.ToString();
-        Assert.Contains("if not original_name:", result);
+        Assert.Contains("if original_name is None:", result);
         Assert.Contains("if original_name == \"select\":", result);
         Assert.Contains("return \"%24select\"", result);
         Assert.Contains("if original_name == \"expand\":", result);
@@ -2124,7 +2124,7 @@ public void WritesNameMapperMethodWithUnescapedProperties()
         });
         writer.Write(method);
         var result = tw.ToString();
-        Assert.Contains("if not original_name:", result);
+        Assert.Contains("if original_name is None:", result);
         Assert.Contains("if original_name == \"start_date_time\":", result);
         Assert.Contains("return \"startDateTime\"", result);
         Assert.Contains("return original_name", result);