@@ -1576,8 +1576,14 @@ def do_affirmative(self, arg):
1576
1576
self ._last_result = cmd2 .CommandResult (arg , data = True )
1577
1577
1578
1578
def do_negative (self , arg ):
1579
+ self ._last_result = cmd2 .CommandResult (arg , data = False )
1580
+
1581
+ def do_affirmative_no_data (self , arg ):
1579
1582
self ._last_result = cmd2 .CommandResult (arg )
1580
1583
1584
+ def do_negative_no_data (self , arg ):
1585
+ self ._last_result = cmd2 .CommandResult ('' , arg )
1586
+
1581
1587
@pytest .fixture
1582
1588
def commandresult_app ():
1583
1589
app = CommandResultApp ()
@@ -1590,11 +1596,19 @@ def test_commandresult_truthy(commandresult_app):
1590
1596
assert commandresult_app ._last_result
1591
1597
assert commandresult_app ._last_result == cmd2 .CommandResult (arg , data = True )
1592
1598
1599
+ run_cmd (commandresult_app , 'affirmative_no_data {}' .format (arg ))
1600
+ assert commandresult_app ._last_result
1601
+ assert commandresult_app ._last_result == cmd2 .CommandResult (arg )
1602
+
1593
1603
def test_commandresult_falsy (commandresult_app ):
1594
1604
arg = 'bar'
1595
1605
run_cmd (commandresult_app , 'negative {}' .format (arg ))
1596
1606
assert not commandresult_app ._last_result
1597
- assert commandresult_app ._last_result == cmd2 .CommandResult (arg )
1607
+ assert commandresult_app ._last_result == cmd2 .CommandResult (arg , data = False )
1608
+
1609
+ run_cmd (commandresult_app , 'negative_no_data {}' .format (arg ))
1610
+ assert not commandresult_app ._last_result
1611
+ assert commandresult_app ._last_result == cmd2 .CommandResult ('' , arg )
1598
1612
1599
1613
1600
1614
def test_is_text_file_bad_input (base_app ):
0 commit comments