예제 #1
0
 def test_settings_margin(self):
     settings = Formatting()
     settings.margin = 4
     try:
         settings.margin = 0
     except ValueError:
         pass
     else:
         self.fail("Expected ValueError")
     try:
         settings.margin = -1
     except ValueError:
         pass
     else:
         self.fail("Expected ValueError")
     try:
         settings.margin = '12'  # no strings
     except ValueError:
         pass
     else:
         self.fail("Expected ValueError")
     try:
         settings.margin = 3.5  # no floats
     except ValueError:
         pass
     else:
         self.fail("Expected ValueError")
예제 #2
0
 def test_settings_margin(self):
     settings = Formatting()
     settings.margin = 4
     try:
         settings.margin = 0
     except ValueError:
         pass
     else:
         self.fail("Expected ValueError")
     try:
         settings.margin = -1
     except ValueError:
         pass
     else:
         self.fail("Expected ValueError")
     try:
         settings.margin = '12'  # no strings
     except ValueError:
         pass
     else:
         self.fail("Expected ValueError")
     try:
         settings.margin = 3.5  # no floats
     except ValueError:
         pass
     else:
         self.fail("Expected ValueError")
예제 #3
0
 def test_inspect_settings_reset(self):
     settings = Formatting()
     repr1 = repr(settings)
     settings.wrap = 10
     settings.truncate = 8
     settings.round = 2
     settings.width = 90
     settings.margin = 4
     settings.with_types = True
     settings.reset()
     repr2 = repr(settings)
     self.assertEqual(repr1, repr2)
예제 #4
0
 def test_inspect_settings_reset(self):
     settings = Formatting()
     repr1 = repr(settings)
     settings.wrap = 10
     settings.truncate = 8
     settings.round = 2
     settings.width = 90
     settings.margin = 4
     settings.with_types = True
     settings.reset()
     repr2 = repr(settings)
     self.assertEqual(repr1, repr2)