def test_checkstr(self): """Test for extracting key and duration from shorthand notation of durations.""" self.assertEqual(archivebot.checkstr('400s'), ('s', '400')) self.assertEqual(archivebot.checkstr('3000'), ('s', '3000')) self.assertEqual(archivebot.checkstr('7d'), ('d', '7')) self.assertEqual(archivebot.checkstr('3y'), ('y', '3')) # Should pass, because the key is verified in str2time self.assertEqual(archivebot.checkstr('4000@'), ('@', '4000'))
def test_checkstr(self): """Test for extracting key and duration from shorthand notation of durations.""" self.assertEqual(archivebot.checkstr('400s'), ('s', '400')) with suppress_warnings('Time period without qualifier', UserWarning): self.assertEqual(archivebot.checkstr('3000'), ('s', '3000')) self.assertEqual(archivebot.checkstr('7d'), ('d', '7')) self.assertEqual(archivebot.checkstr('3y'), ('y', '3')) # Should pass, because the key is verified in str2time self.assertEqual(archivebot.checkstr('4000@'), ('@', '4000'))
def test_checkstr(self): """Test for extracting key and duration from shorthand notation.""" self.assertEqual(archivebot.checkstr('400s'), ('s', '400')) self.assertEqual(archivebot.checkstr('7d'), ('d', '7')) self.assertEqual(archivebot.checkstr('3y'), ('y', '3')) for invalid_value in ('', '3000', '4000@'): with self.assertRaises(archivebot.MalformedConfigError): archivebot.checkstr(invalid_value)