mirror of
https://github.com/twitter/the-algorithm-ml.git
synced 2024-12-23 23:01:48 +01:00
22 lines
514 B
Python
22 lines
514 B
Python
import unittest
|
|
|
|
from tml.ml_logging.torch_logging import logging
|
|
|
|
|
|
class Testtlogging(unittest.TestCase):
|
|
def test_warn_once(self):
|
|
with self.assertLogs(level="INFO") as captured_logs:
|
|
logging.info("first info")
|
|
logging.warning("first warning")
|
|
logging.warning("first warning")
|
|
logging.info("second info")
|
|
|
|
self.assertEqual(
|
|
captured_logs.output,
|
|
[
|
|
"INFO:absl:first info",
|
|
"WARNING:absl:first warning",
|
|
"INFO:absl:second info",
|
|
],
|
|
)
|