def test_never_timeout(self): session = Session() for _ in range(2): token1 = session.session_token sleep(300) token2 = session.session_token self.assertNotEqual(token1, token2) session.close()
class BaseTestCase(unittest.TestCase): csv_file = 'test.csv' @classmethod def setUpClass(cls) -> None: warnings.filterwarnings("ignore", category=DeprecationWarning) if not os.path.exists(BaseTestCase.csv_file): with open(BaseTestCase.csv_file, 'w'): pass make_random_csv(5, 1000, output_file=BaseTestCase.csv_file) @classmethod def tearDownClass(cls) -> None: if os.path.exists(BaseTestCase.csv_file): os.remove(BaseTestCase.csv_file) def setUp(self) -> None: self.session = Session() def tearDown(self) -> None: self.session.close()
def test_time_table(self): session = Session() t = session.time_table(period=100000) self.assertFalse(t.is_static) session.close()
def test_empty_table(self): session = Session() t = session.empty_table(1000) self.assertEqual(t.size, 1000) session.close()
def test_close(self): session = Session() session.close() self.assertEqual(False, session.is_connected) self.assertEqual(False, session.is_alive)