Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

test_openapi: Make get_standardized_argument_type understand X | Y.

Anders Kaseorgf04e7fc625af
diff --git a/zerver/tests/test_openapi.py b/zerver/tests/test_openapi.py
index dcb41528606..e36cb0c175a 100644
--- a/zerver/tests/test_openapi.py
+++ b/zerver/tests/test_openapi.py
@@ -1,5 +1,6 @@
import inspect
import os
+import types
from collections import abc
from typing import (
Any,
@@ -350,7 +351,7 @@ so maybe we shouldn't mark it as intentionally undocumented in the URLs.
# Then it's most likely one of the fundamental data types
# I.E. Not one of the data types from the "typing" module.
return t
- elif origin == Union:
+ elif origin in (Union, types.UnionType):
subtypes = [self.get_standardized_argument_type(st) for st in get_args(t)]
return self.get_type_by_priority(subtypes)
elif origin in [list, abc.Sequence]: