diff options
author | luke@maurits.id.au <luke@maurits.id.au@0f58610c-415a-11de-9c03-5d6cfad8e937> | 2012-05-18 02:46:06 +0000 |
---|---|---|
committer | luke@maurits.id.au <luke@maurits.id.au@0f58610c-415a-11de-9c03-5d6cfad8e937> | 2012-05-18 02:46:06 +0000 |
commit | 4030d975b8c89acb0504c16be04681b13e8c9e94 (patch) | |
tree | ad1e98a068c723875da4c100dbda3d1e6dc726a9 /prettytable_test.py | |
parent | 57f2ada34e1769849b9282a4063d1e69c0d4dfd0 (diff) | |
download | python-prettytable-4030d975b8c89acb0504c16be04681b13e8c9e94.tar.gz |
1) Fixed a bug regarding validation of max_width, on the basis of an email from Anthony Toole. Also made some other changes to validation code and unit testing on the basis of this bug.
2) Repaired Python 3 compatibility, which the switch to StringIO had broken.
git-svn-id: http://prettytable.googlecode.com/svn/trunk@65 0f58610c-415a-11de-9c03-5d6cfad8e937
Diffstat (limited to 'prettytable_test.py')
-rw-r--r-- | prettytable_test.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/prettytable_test.py b/prettytable_test.py index d53c1ca..a3adc4d 100644 --- a/prettytable_test.py +++ b/prettytable_test.py @@ -121,6 +121,38 @@ class OptionOverrideTests(CityDataTest): override = self.x.get_string(hrules=NONE) self.assertTrue(default != override) +class OptionAttributeTests(CityDataTest): + + """Make sure all options which have an attribute interface work as they should.""" + + def testSetForAllColumns(self): + self.x.field_names = sorted(self.x.field_names) + self.x.align = "l" + self.x.max_width = 10 + self.x.start = 2 + self.x.end = 4 + self.x.sortby = "Area" + self.x.reversesort = True + self.x.header = True + self.x.border = False + self.x.hrule = True + self.x.int_format = "4" + self.x.float_format = "2.2" + self.x.padding_width = 2 + self.x.left_padding_width = 2 + self.x.right_padding_width = 2 + self.x.vertical_char = "!" + self.x.horizontal_char = "~" + self.x.junction_char = "*" + self.x.format = True + self.x.attributes = {"class" : "prettytable"} + + def testSetForOneColumn(self): + self.x.align["Rainfall"] = "l" + self.x.max_width["Name"] = 10 + self.x.int_format["Population"] = "4" + self.x.float_format["Area"] = "2.2" + class BasicTests(CityDataTest): """Some very basic tests.""" |