def test_validate_size_format(self): with self.subTest('lower 1'): self.assertTrue(LivyHook._validate_size_format('1m')) with self.subTest('lower 2'): self.assertTrue(LivyHook._validate_size_format('1mb')) with self.subTest('upper 1'): self.assertTrue(LivyHook._validate_size_format('1G')) with self.subTest('upper 2'): self.assertTrue(LivyHook._validate_size_format('1GB')) with self.subTest('snake 1'): self.assertTrue(LivyHook._validate_size_format('1Gb')) with self.subTest('fullmatch'): with self.assertRaises(ValueError): self.assertTrue(LivyHook._validate_size_format('1Gb foo')) with self.subTest('missing size'): with self.assertRaises(ValueError): self.assertTrue(LivyHook._validate_size_format('10')) with self.subTest('numeric'): with self.assertRaises(ValueError): LivyHook._validate_size_format(1) with self.subTest('None'): # noinspection PyTypeChecker self.assertTrue(LivyHook._validate_size_format(None))
def test_validate_size_format(self): with self.subTest('lower 1'): assert LivyHook._validate_size_format('1m') with self.subTest('lower 2'): assert LivyHook._validate_size_format('1mb') with self.subTest('upper 1'): assert LivyHook._validate_size_format('1G') with self.subTest('upper 2'): assert LivyHook._validate_size_format('1GB') with self.subTest('snake 1'): assert LivyHook._validate_size_format('1Gb') with self.subTest('fullmatch'): with pytest.raises(ValueError): assert LivyHook._validate_size_format('1Gb foo') with self.subTest('missing size'): with pytest.raises(ValueError): assert LivyHook._validate_size_format('10') with self.subTest('numeric'): with pytest.raises(ValueError): LivyHook._validate_size_format(1) # noqa with self.subTest('None'): assert LivyHook._validate_size_format(None) # noqa