Best Python code snippet using localstack_python
test_utils.py
Source:test_utils.py
...87 self.assertEqual(expected, ts.s3xmlformat)88 # Bigger float (milliseconds) should be floored too89 ts = utils.S3Timestamp(1.9)90 self.assertEqual(expected, ts.s3xmlformat)91 def test_mktime(self):92 date_headers = [93 'Thu, 01 Jan 1970 00:00:00 -0000',94 'Thu, 01 Jan 1970 00:00:00 GMT',95 'Thu, 01 Jan 1970 00:00:00 UTC',96 'Thu, 01 Jan 1970 08:00:00 +0800',97 'Wed, 31 Dec 1969 16:00:00 -0800',98 'Wed, 31 Dec 1969 16:00:00 PST',99 ]100 for header in date_headers:101 ts = utils.mktime(header)102 self.assertEqual(0, ts, 'Got %r for header %s' % (ts, header))103 # Last-Modified response style104 self.assertEqual(0, utils.mktime('1970-01-01T00:00:00'))105 # X-Amz-Date style106 self.assertEqual(0, utils.mktime('19700101T000000Z',107 request.SIGV4_X_AMZ_DATE_FORMAT))108 def test_mktime_weird_tz(self):109 orig_tz = os.environ.get('TZ', '')110 try:111 os.environ['TZ'] = 'EST+05EDT,M4.1.0,M10.5.0'112 time.tzset()113 os.environ['TZ'] = '+0000'114 # No tzset! Simulating what Swift would do.115 self.assertNotEqual(0, time.timezone)116 self.test_mktime()117 finally:118 os.environ['TZ'] = orig_tz119 time.tzset()120if __name__ == '__main__':...
insight_time.py
Source:insight_time.py
...23 st = time.localtime()24 print time.strftime('%Y-%m-%d %H:%M:%S', st)25def test_strptime():26 print time.strptime('2020-07-01 10:00:00', '%H:%m:%d %H:%M:%S')27def test_mktime():28 st = time.localtime()29 print time.mktime(st)30def test_gmtime():31 st = time.localtime()32 unix_time = time.mktime(st)33 print time.gmtime(unix_time)34def test_asctime():35 st = time.localtime()36 print time.asctime(st)37def test_clock():38 print time.clock()39def test_ctime():40 print time.ctime()41#test_struct_time()42#test_strftime()43#test_mktime()44#test_asctime()45#test_clock()46#test_gmtime()47#test_time()...
test_web.py
Source:test_web.py
1import logging2import time3from fooster.web import web4def test_mktime():5 assert web.mktime(time.gmtime(0)) == 'Thu, 01 Jan 1970 00:00:00 GMT'6def test_mklog_web():7 log = web.mklog('web')8 assert log is logging.getLogger('web')9def test_mklog_http():10 http_log = web.mklog('http', access_log=True)11 assert http_log is logging.getLogger('http')...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!