From 86a59f8551fcbc4baed7fc77e28a1214cdbc9211 Mon Sep 17 00:00:00 2001 From: "luke@maurits.id.au" Date: Sat, 6 Apr 2013 23:50:28 +0000 Subject: Backporting print_empty feature from trunk. git-svn-id: http://prettytable.googlecode.com/svn/branches/0.7@126 0f58610c-415a-11de-9c03-5d6cfad8e937 --- prettytable_test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'prettytable_test.py') diff --git a/prettytable_test.py b/prettytable_test.py index 3d0daeb..66a821b 100644 --- a/prettytable_test.py +++ b/prettytable_test.py @@ -223,6 +223,25 @@ class HrulesAllBasicTests(BasicTests): BasicTests.setUp(self) self.x.hrules = ALL +class EmptyTableTests(CityDataTest): + + """Make sure the print_empty option works""" + + def setUp(self): + CityDataTest.setUp(self) + self.y = PrettyTable() + self.y.field_names = ["City name", "Area", "Population", "Annual Rainfall"] + + def testPrintEmptyTrue(self): + assert self.y.get_string(print_empty=True) != "" + assert self.x.get_string(print_empty=True) != self.y.get_string(print_empty=True) + + def testPrintEmptyFalse(self): + assert self.y.get_string(print_empty=False) == "" + assert self.y.get_string(print_empty=False) != self.x.get_string(print_empty=False) + + def testInteractionWithBorder(self): + assert self.y.get_string(border=False, print_empty=True) == "" class PresetBasicTests(BasicTests): """Run the basic tests after using set_style""" -- cgit v1.2.1