From 5972332f2e4b63da2a5461d260e9426f052e2630 Mon Sep 17 00:00:00 2001 From: Joe Chen Date: Fri, 19 Apr 2019 20:05:24 -0700 Subject: [PATCH] Migrate more tests from helputils_test.py to helptext_test.py PiperOrigin-RevId: 244461697 Change-Id: I96d77f4cce436b017279ef203f6c4530d1e2f93b --- fire/helptext_test.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/fire/helptext_test.py b/fire/helptext_test.py index 89eade95..190dad1b 100644 --- a/fire/helptext_test.py +++ b/fire/helptext_test.py @@ -89,6 +89,31 @@ def testHelpTextFunctionWithDefaults(self): self.assertIn('FLAGS\n --count', help_screen) self.assertNotIn('NOTES', help_screen) + def testHelpTextFunctionWithBuiltin(self): + component = 'test'.upper + info = inspectutils.Info(component) + help_screen = helptext.HelpText( + component=component, + info=info, + trace=trace.FireTrace(component, 'upper')) + self.assertIn('NAME\n upper', help_screen) + self.assertIn('SYNOPSIS\n upper', help_screen) + # We don't check description content here since the content is python + # version dependent. + self.assertIn('DESCRIPTION\n', help_screen) + self.assertNotIn('NOTES', help_screen) + + def testHelpTextFunctionIntType(self): + component = int + info = inspectutils.Info(component) + help_screen = helptext.HelpText( + component=component, info=info, trace=trace.FireTrace(component, 'int')) + self.assertIn('NAME\n int', help_screen) + self.assertIn('SYNOPSIS\n int', help_screen) + # We don't check description content here since the content is python + # version dependent. + self.assertIn('DESCRIPTION\n', help_screen) + def testHelpScreen(self): component = tc.ClassWithDocstring() t = trace.FireTrace(component, name='ClassWithDocstring')