Example #1
0
 def test_smart(self):
     options = parse_options([])
     self.assertTrue(options.smart)
     options = parse_options(["-s"])
     self.assertFalse(options.smart)
     options = parse_options(["--smart"])
     self.assertFalse(options.smart)
Example #2
0
 def test_device(self):
     """Test for the --device option."""
     options = parse_options([])
     self.assertFalse(options.device)
     options = parse_options(["-d"])
     self.assertTrue(options.device)
     options = parse_options(["--device"])
     self.assertTrue(options.device)
Example #3
0
 def test_terabytes(self):
     """Test for the --terabytes option."""
     options = parse_options([])
     self.assertEqual(options.divisor, None)
     options = parse_options(["-t"])
     self.assertEqual(options.divisor, 3)
     options = parse_options(["--terabytes"])
     self.assertEqual(options.divisor, 3)
Example #4
0
 def test_reserved(self):
     """ Test for the --reserved option."""
     options = parse_options([])
     self.assertFalse(options.reserved)
     options = parse_options(["-r"])
     self.assertTrue(options.reserved)
     options = parse_options(["--reserved"])
     self.assertTrue(options.reserved)
Example #5
0
 def test_megabytes(self):
     """Test for the --megabytes option."""
     options = parse_options([])
     self.assertEqual(options.divisor, None)
     options = parse_options(["-m"])
     self.assertEqual(options.divisor, 1)
     options = parse_options(["--megabytes"])
     self.assertEqual(options.divisor, 1)
Example #6
0
 def test_kilobytes(self):
     """Test for the --kilobytes option."""
     options = parse_options([])
     self.assertEqual(options.divisor, None)
     options = parse_options(["-k"])
     self.assertEqual(options.divisor, 0)
     options = parse_options(["--kilobytes"])
     self.assertEqual(options.divisor, 0)
Example #7
0
 def test_gigabytes(self):
     """Test for the --gigabytes option."""
     options = parse_options([])
     self.assertEqual(options.divisor, None)
     options = parse_options(["-g"])
     self.assertEqual(options.divisor, 2)
     options = parse_options(["--gigabytes"])
     self.assertEqual(options.divisor, 2)
Example #8
0
 def test_color(self):
     """Test for the --color option."""
     options = parse_options([])
     self.assertTrue(options.color)
     options = parse_options(["-c"])
     self.assertFalse(options.color)
     options = parse_options(["--color"])
     self.assertFalse(options.color)
Example #9
0
 def test_places(self):
     options = parse_options([])
     self.assertEqual(options.places, None)
     options = parse_options(["-p", "0"])
     self.assertEqual(options.places, 0)
     options = parse_options(["-p", "9"])
     self.assertEqual(options.places, 9)
     with self.assertRaises((SystemExit, argparse.ArgumentError)):
         parse_options(["-p", "10"])
     with self.assertRaises((SystemExit, argparse.ArgumentError)):
         parse_options(["-p", "-1"])