Skip to content

Commit ceca1eb

Browse files
codestyle test
1 parent 4fbe81a commit ceca1eb

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

tests/unit/test_utils.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,85 +1283,79 @@ def test_resolve_value_from_config():
12831283
class TestLogSagemakerConfig(TestCase):
12841284

12851285
def test_sensitive_info_masking(self):
1286-
logger = logging.getLogger('sagemaker.config')
1286+
logger = logging.getLogger("sagemaker.config")
12871287
logger.setLevel(logging.DEBUG)
12881288

12891289
stream_handler = logging.StreamHandler()
12901290
logger.addHandler(stream_handler)
12911291

12921292
# source value is None
1293-
with self.assertLogs(logger, level='DEBUG') as log:
1293+
with self.assertLogs(logger, level="DEBUG") as log:
12941294
_log_sagemaker_config_single_substitution(
1295-
None,
1296-
{"apiKey": "topsecretkey"},
1297-
"config/path"
1295+
None, {"apiKey": "topsecretkey"}, "config/path"
12981296
)
12991297

13001298
self.assertIn("config value that will be used = {'apiKey': '***'}", log.output[0])
13011299

13021300
# source value is None and config_value == source_value
1303-
with self.assertLogs(logger, level='DEBUG') as log:
1301+
with self.assertLogs(logger, level="DEBUG") as log:
13041302
_log_sagemaker_config_single_substitution(
1305-
{"secretword": "topsecretword"},
1306-
{"secretword": "topsecretword"},
1307-
"config/path"
1303+
{"secretword": "topsecretword"}, {"secretword": "topsecretword"}, "config/path"
13081304
)
13091305

13101306
self.assertIn("Skipped value", log.output[0])
13111307
self.assertIn("source value that will be used = {'secretword': '***'}", log.output[0])
13121308
self.assertIn("config value = {'secretword': '***'}", log.output[0])
13131309

13141310
# source value is not None and config_value != source_value
1315-
with self.assertLogs(logger, level='DEBUG') as log:
1311+
with self.assertLogs(logger, level="DEBUG") as log:
13161312
_log_sagemaker_config_single_substitution(
1317-
{"password": "supersecretpassword"},
1318-
{"apiKey": "topsecretkey"},
1319-
"config/path"
1313+
{"password": "supersecretpassword"}, {"apiKey": "topsecretkey"}, "config/path"
13201314
)
13211315

13221316
self.assertIn("Skipped value", log.output[0])
13231317
self.assertIn("source value that will be used = {'password': '***'}", log.output[0])
13241318
self.assertIn("config value = {'apiKey': '***'}", log.output[0])
13251319

13261320
def test_non_sensitive_info_masking(self):
1327-
logger = logging.getLogger('sagemaker.config')
1321+
logger = logging.getLogger("sagemaker.config")
13281322
logger.setLevel(logging.DEBUG)
13291323

13301324
stream_handler = logging.StreamHandler()
13311325
logger.addHandler(stream_handler)
13321326

13331327
# source value is None
1334-
with self.assertLogs(logger, level='DEBUG') as log:
1328+
with self.assertLogs(logger, level="DEBUG") as log:
13351329
_log_sagemaker_config_single_substitution(
1336-
None,
1337-
{"username": "randomvalue"},
1338-
"config/path"
1330+
None, {"username": "randomvalue"}, "config/path"
13391331
)
13401332

13411333
self.assertIn("config value that will be used = {'username': 'randomvalue'}", log.output[0])
13421334

13431335
# source value is not None and config_value == source_value
1344-
with self.assertLogs(logger, level='DEBUG') as log:
1336+
with self.assertLogs(logger, level="DEBUG") as log:
13451337
_log_sagemaker_config_single_substitution(
13461338
{"nonsensitivevalue": "randomvalue"},
13471339
{"nonsensitivevalue": "randomvalue"},
1348-
"config/path"
1340+
"config/path",
13491341
)
13501342

13511343
self.assertIn("Skipped value", log.output[0])
13521344
self.assertIn("source value that will be used = {'nonsensitivevalue': 'randomvalue'}", log.output[0])
13531345
self.assertIn("config value = {'nonsensitivevalue': 'randomvalue'}", log.output[0])
13541346

13551347
# source value is not None and config_value != source_value
1356-
with self.assertLogs(logger, level='DEBUG') as log:
1348+
with self.assertLogs(logger, level="DEBUG") as log:
13571349
_log_sagemaker_config_single_substitution(
13581350
{"username": "nonsensitiveinfo"},
13591351
{"configvalue": "nonsensitivevalue"},
1360-
"config/path/non_sensitive"
1352+
"config/path/non_sensitive",
13611353
)
13621354

13631355
self.assertIn("Skipped value", log.output[0])
1364-
self.assertIn("source value that will be used = {'username': 'nonsensitiveinfo'}", log.output[0])
1356+
self.assertIn(
1357+
"source value that will be used = {'username': 'nonsensitiveinfo'}", log.output[0]
1358+
)
13651359
self.assertIn("config value = {'configvalue': 'nonsensitivevalue'}", log.output[0])
13661360

13671361

0 commit comments

Comments
 (0)