How to use _format_duration method in Slash

Best Python code snippet using slash

test_pretty.py

Source:test_pretty.py Github

copy

Full Screen

...99 assert pretty_client._format_datetime(datetime(2019, 2, 3, 23, 11, 59)) == '3 Feb 2019 at 23:11'100 assert pretty_client._format_datetime(datetime(*t + [11, 11])) == 'Today at 11:11'101 assert pretty_client._format_datetime(datetime(*t + [11, 11]) - rd(days=1)) == 'Yesterday at 11:11'102 assert pretty_client._format_datetime(datetime(*t + [11, 11]) + rd(days=1)) == 'Tomorrow at 11:11'103def test_format_duration():104 assert PrettyPachydermClient._format_duration(None) == ''105 assert PrettyPachydermClient._format_duration(0) == ''106 assert PrettyPachydermClient._format_duration(0.001) == '1 ms'107 assert PrettyPachydermClient._format_duration(1) == '1 sec'108 assert PrettyPachydermClient._format_duration(2) == '2 secs'109 assert PrettyPachydermClient._format_duration(2.1) == '2 secs'110 assert PrettyPachydermClient._format_duration(60) == '1 min'111 assert PrettyPachydermClient._format_duration(120) == '2 mins'112 assert PrettyPachydermClient._format_duration(121) == '2 mins'113 assert PrettyPachydermClient._format_duration(3600) == '1 hour'114 assert PrettyPachydermClient._format_duration(7200) == '2 hours'115 assert PrettyPachydermClient._format_duration(3660) == '1 hour, 1 min'116 assert PrettyPachydermClient._format_duration(7260) == '2 hours, 1 min'117 assert PrettyPachydermClient._format_duration(7320) == '2 hours, 2 mins'118 assert PrettyPachydermClient._format_duration(7322) == '2 hours, 2 mins'119 assert PrettyPachydermClient._format_duration(86400) == '1 day'120 assert PrettyPachydermClient._format_duration(90000) == '1 day, 1 hour'121def test_format_size():122 assert PrettyPachydermClient._format_size(0) == '0 bytes'123 assert PrettyPachydermClient._format_size(1) == '1 byte'124 assert PrettyPachydermClient._format_size(1000) == '1.0 KB'125 assert PrettyPachydermClient._format_size(10100) == '10.1 KB'126 assert PrettyPachydermClient._format_size(1200000) == '1.2 MB'127 assert PrettyPachydermClient._format_size(100300000) == '100.3 MB'128 assert PrettyPachydermClient._format_size(1400000000) == '1.4 GB'129 assert PrettyPachydermClient._format_size(1500000000000) == '1.5 TB'...

Full Screen

Full Screen

tests.py

Source:tests.py Github

copy

Full Screen

...58 response = self.client.get('/go/192.168.0.42/dir/icon.png', follow=False)59 self.assertEqual(response.status_code, 302)60 self.assertEqual(response['Location'], 'ftp://192.168.0.42/dir/icon.png')61 def test_time_format(self):62 self.assertEqual(FtpServer._format_duration(5), u"5 seconds")63 self.assertEqual(FtpServer._format_duration(-5), u"just now")64 self.assertEqual(FtpServer._format_duration(0), u"just now")65 self.assertEqual(FtpServer._format_duration(66 2 * 60 + 8),67 u"2 minutes")68 self.assertEqual(FtpServer._format_duration(69 (23 * 60 + 18) * 60 + 54),70 u"23 hours")71 self.assertEqual(FtpServer._format_duration(72 ((4 * 24 + 3) * 60 + 18) * 60 + 54),73 u"4 days")74 self.assertEqual(FtpServer._format_duration(75 ((1024 * 24 + 3) * 60 + 18) * 60 + 54),76 u"146 weeks")77class FileIconsTest(TestCase):78 def test_common_extensions(self):79 self.assertEqual(guess_file_icon('tagada.avi'), 'film')80 self.assertEqual(guess_file_icon('tagada.mkv'), 'film')81 self.assertEqual(guess_file_icon('tagada.mp3'), 'music')82 def test_uppercase(self):83 self.assertEqual(guess_file_icon('tagada.MP3'), 'music')84 def test_application_x(self):...

Full Screen

Full Screen

test_file_formatter.py

Source:test_file_formatter.py Github

copy

Full Screen

2from unittest import TestCase3from file_formatter import Formatter4class TestFormatDuration(TestCase):5 def test_success(self) -> None:6 self.assertEqual(Formatter._format_duration(0), "0:00")7 self.assertEqual(Formatter._format_duration(999), "0:00")8 self.assertEqual(Formatter._format_duration(1000), "0:01")9 self.assertEqual(Formatter._format_duration(59999), "0:59")10 self.assertEqual(Formatter._format_duration(60000), "1:00")11 self.assertEqual(Formatter._format_duration(3599999), "59:59")12 self.assertEqual(Formatter._format_duration(3600000), "1:00:00")13class TestFormatDurationEnglish(TestCase):14 def test_success(self) -> None:15 self.assertEqual(Formatter._format_duration_english(0), "0 sec")16 self.assertEqual(Formatter._format_duration_english(999), "0 sec")17 self.assertEqual(Formatter._format_duration_english(1000), "1 sec")18 self.assertEqual(Formatter._format_duration_english(59999), "59 sec")19 self.assertEqual(Formatter._format_duration_english(60000), "1 min 0 sec")20 self.assertEqual(Formatter._format_duration_english(3599999), "59 min 59 sec")21 self.assertEqual(Formatter._format_duration_english(3600000), "1 hr 0 min")22 self.assertEqual(Formatter._format_duration_english(86399999), "23 hr 59 min")23 self.assertEqual(24 Formatter._format_duration_english(86400000), "1 day 0 hr 0 min"25 )26 self.assertEqual(...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Slash automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful