Skip to content

Commit 84169ba

Browse files
format fix
1 parent 2a927e1 commit 84169ba

2 files changed

Lines changed: 39 additions & 39 deletions

File tree

tests/runtime/test_environment_utils.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_constants(self):
3737
def test_get_observability_authentication_scope_returns_prod_scope(self):
3838
"""Test that get_observability_authentication_scope returns production scope."""
3939
result = get_observability_authentication_scope()
40-
40+
4141
self.assertIsInstance(result, list)
4242
self.assertEqual(len(result), 1)
4343
self.assertEqual(result[0], PROD_OBSERVABILITY_SCOPE)
@@ -47,23 +47,23 @@ def test_is_development_environment_with_no_env_var(self):
4747
# Ensure environment variables are not set
4848
if "PYTHON_ENVIRONMENT" in os.environ:
4949
del os.environ["PYTHON_ENVIRONMENT"]
50-
50+
5151
result = is_development_environment()
52-
52+
5353
self.assertFalse(result)
5454

5555
def test_is_development_environment_with_development_env_var(self):
5656
"""Test is_development_environment returns True when PYTHON_ENVIRONMENT is 'Development'."""
5757
os.environ["PYTHON_ENVIRONMENT"] = "Development"
58-
58+
5959
result = is_development_environment()
60-
60+
6161
self.assertTrue(result)
6262

6363
def test_is_development_environment_case_insensitive(self):
6464
"""Test is_development_environment is case-insensitive."""
6565
test_cases = ["development", "DEVELOPMENT", "DeveLoPMenT", "Development"]
66-
66+
6767
for env_value in test_cases:
6868
with self.subTest(env_value=env_value):
6969
os.environ["PYTHON_ENVIRONMENT"] = env_value
@@ -73,15 +73,15 @@ def test_is_development_environment_case_insensitive(self):
7373
def test_is_development_environment_with_production_env_var(self):
7474
"""Test is_development_environment returns False when PYTHON_ENVIRONMENT is 'production'."""
7575
os.environ["PYTHON_ENVIRONMENT"] = "production"
76-
76+
7777
result = is_development_environment()
78-
78+
7979
self.assertFalse(result)
8080

8181
def test_is_development_environment_with_other_env_var(self):
8282
"""Test is_development_environment returns False for other environment values."""
8383
test_cases = ["staging", "test", "preprod", "custom"]
84-
84+
8585
for env_value in test_cases:
8686
with self.subTest(env_value=env_value):
8787
os.environ["PYTHON_ENVIRONMENT"] = env_value
@@ -91,35 +91,35 @@ def test_is_development_environment_with_other_env_var(self):
9191
def test_is_development_environment_with_empty_env_var(self):
9292
"""Test is_development_environment returns False when PYTHON_ENVIRONMENT is empty."""
9393
os.environ["PYTHON_ENVIRONMENT"] = ""
94-
94+
9595
result = is_development_environment()
96-
96+
9797
self.assertFalse(result)
9898

9999
def test_is_development_environment_with_whitespace_env_var(self):
100100
"""Test is_development_environment returns False when PYTHON_ENVIRONMENT is whitespace."""
101101
os.environ["PYTHON_ENVIRONMENT"] = " "
102-
102+
103103
result = is_development_environment()
104-
104+
105105
self.assertFalse(result)
106106

107107
@patch.dict(os.environ, {"PYTHON_ENVIRONMENT": "Development"}, clear=False)
108108
def test_python_environment_precedence(self):
109109
"""Test that PYTHON_ENVIRONMENT takes precedence."""
110110
result = is_development_environment()
111-
111+
112112
self.assertTrue(result)
113113

114114
def test_default_environment_is_production(self):
115115
"""Test that the default environment is production when no env vars are set."""
116116
# Ensure no environment variables are set
117117
if "PYTHON_ENVIRONMENT" in os.environ:
118118
del os.environ["PYTHON_ENVIRONMENT"]
119-
119+
120120
# The _get_current_environment function should default to PRODUCTION_ENVIRONMENT_NAME
121121
result = is_development_environment()
122-
122+
123123
self.assertFalse(result)
124124

125125

@@ -129,33 +129,33 @@ class TestObservabilityAuthenticationScope(unittest.TestCase):
129129
def test_scope_is_list(self):
130130
"""Test that the scope is returned as a list."""
131131
result = get_observability_authentication_scope()
132-
132+
133133
self.assertIsInstance(result, list)
134134

135135
def test_scope_contains_single_value(self):
136136
"""Test that the scope list contains exactly one value."""
137137
result = get_observability_authentication_scope()
138-
138+
139139
self.assertEqual(len(result), 1)
140140

141141
def test_scope_value_is_string(self):
142142
"""Test that the scope value is a string."""
143143
result = get_observability_authentication_scope()
144-
144+
145145
self.assertIsInstance(result[0], str)
146146

147147
def test_scope_value_format(self):
148148
"""Test that the scope value has the correct format."""
149149
result = get_observability_authentication_scope()
150-
150+
151151
self.assertTrue(result[0].startswith("https://"))
152152
self.assertTrue(result[0].endswith(".default"))
153153

154154
def test_scope_consistency(self):
155155
"""Test that multiple calls return the same scope."""
156156
result1 = get_observability_authentication_scope()
157157
result2 = get_observability_authentication_scope()
158-
158+
159159
self.assertEqual(result1, result2)
160160

161161

tests/runtime/test_version_utils.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,30 @@ def test_build_version_returns_string(self):
2323
with warnings.catch_warnings():
2424
warnings.simplefilter("ignore", DeprecationWarning)
2525
result = build_version()
26-
26+
2727
self.assertIsInstance(result, str)
2828

2929
def test_build_version_default_value(self):
3030
"""Test build_version returns default version when no env var is set."""
3131
# Ensure environment variable is not set
3232
if "AGENT365_PYTHON_SDK_PACKAGE_VERSION" in os.environ:
3333
del os.environ["AGENT365_PYTHON_SDK_PACKAGE_VERSION"]
34-
34+
3535
with warnings.catch_warnings():
3636
warnings.simplefilter("ignore", DeprecationWarning)
3737
result = build_version()
38-
38+
3939
self.assertEqual(result, "0.0.0")
4040

4141
def test_build_version_with_env_var(self):
4242
"""Test build_version returns version from environment variable."""
4343
test_version = "1.2.3"
4444
os.environ["AGENT365_PYTHON_SDK_PACKAGE_VERSION"] = test_version
45-
45+
4646
with warnings.catch_warnings():
4747
warnings.simplefilter("ignore", DeprecationWarning)
4848
result = build_version()
49-
49+
5050
self.assertEqual(result, test_version)
5151

5252
def test_build_version_with_complex_version(self):
@@ -58,32 +58,32 @@ def test_build_version_with_complex_version(self):
5858
"1.2.3+build.456",
5959
"2.0.0-alpha.1+build.789",
6060
]
61-
61+
6262
for version in test_cases:
6363
with self.subTest(version=version):
6464
os.environ["AGENT365_PYTHON_SDK_PACKAGE_VERSION"] = version
65-
65+
6666
with warnings.catch_warnings():
6767
warnings.simplefilter("ignore", DeprecationWarning)
6868
result = build_version()
69-
69+
7070
self.assertEqual(result, version)
7171

7272
def test_build_version_with_empty_env_var(self):
7373
"""Test build_version with empty environment variable."""
7474
os.environ["AGENT365_PYTHON_SDK_PACKAGE_VERSION"] = ""
75-
75+
7676
with warnings.catch_warnings():
7777
warnings.simplefilter("ignore", DeprecationWarning)
7878
result = build_version()
79-
79+
8080
self.assertEqual(result, "")
8181

8282
def test_build_version_deprecation_warning(self):
8383
"""Test that build_version raises DeprecationWarning."""
8484
with self.assertWarns(DeprecationWarning) as cm:
8585
build_version()
86-
86+
8787
warning_message = str(cm.warning)
8888
self.assertIn("deprecated", warning_message.lower())
8989
self.assertIn("setuptools-git-versioning", warning_message)
@@ -93,13 +93,13 @@ def test_build_version_deprecation_warning_message(self):
9393
with warnings.catch_warnings(record=True) as w:
9494
warnings.simplefilter("always")
9595
build_version()
96-
96+
9797
# Check that exactly one warning was raised
9898
self.assertEqual(len(w), 1)
99-
99+
100100
# Check that it's a DeprecationWarning
101101
self.assertTrue(issubclass(w[0].category, DeprecationWarning))
102-
102+
103103
# Check the message content
104104
message = str(w[0].message)
105105
self.assertIn("build_version() is deprecated", message)
@@ -110,12 +110,12 @@ def test_build_version_stacklevel(self):
110110
with warnings.catch_warnings(record=True) as w:
111111
warnings.simplefilter("always")
112112
build_version()
113-
113+
114114
# The warning should point to the caller of build_version
115115
# not to the function itself (stacklevel=2)
116116
self.assertEqual(len(w), 1)
117117
warning = w[0]
118-
118+
119119
# Verify the warning was captured
120120
self.assertIsNotNone(warning.filename)
121121
self.assertGreater(warning.lineno, 0)
@@ -127,14 +127,14 @@ class TestVersionUtilsDocstring(unittest.TestCase):
127127
def test_module_has_docstring(self):
128128
"""Test that the module has a docstring."""
129129
import microsoft_agents_a365.runtime.version_utils as version_utils
130-
130+
131131
self.assertIsNotNone(version_utils.__doc__)
132132
self.assertGreater(len(version_utils.__doc__), 0)
133133

134134
def test_module_docstring_mentions_deprecation(self):
135135
"""Test that module docstring mentions deprecation."""
136136
import microsoft_agents_a365.runtime.version_utils as version_utils
137-
137+
138138
self.assertIn("deprecated", version_utils.__doc__.lower())
139139

140140
def test_function_has_docstring(self):

0 commit comments

Comments
 (0)