Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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"])