diff --git a/tests/directives.beancount b/tests/directives.beancount
index 32ef224..87ec2ad 100644
--- a/tests/directives.beancount
+++ b/tests/directives.beancount
@@ -223,16 +223,16 @@ poptag #foo
 
 ; python
 ;   def print_type(val):
-;     print type(val), val
+;     print(type(val), val)
 ;
 ; eval print_type(true)
 
 ; python
 ;     def option_pyfirst(context):
-;         print "In --pyfirst (from %s)" % context
+;         print("In --pyfirst (from %s)" % context)
 ;
 ;     def option_pysecond(context, val):
-;         print "In --pysecond=%s (from %s)" % (val, context)
+;         print("In --pysecond=%s (from %s)" % (val, context))
 2019-04-28 * "Transactions can follow python without empty line"
   Assets:Test                        10.00 EUR
   Equity:Opening-Balance            -10.00 EUR
diff --git a/tests/directives.ledger b/tests/directives.ledger
index 4ef5909..42f211b 100644
--- a/tests/directives.ledger
+++ b/tests/directives.ledger
@@ -213,16 +213,16 @@ import os
 
 python
   def print_type(val):
-    print type(val), val
+    print(type(val), val)
 
 eval print_type(true)
 
 python
     def option_pyfirst(context):
-        print "In --pyfirst (from %s)" % context
+        print("In --pyfirst (from %s)" % context)
 
     def option_pysecond(context, val):
-        print "In --pysecond=%s (from %s)" % (val, context)
+        print("In --pysecond=%s (from %s)" % (val, context))
 2019-04-28 * Transactions can follow python without empty line
     Assets:Test                        10.00 EUR
     Equity:Opening-Balance            -10.00 EUR
