@@ -38,13 +38,28 @@ def test_write_default(self):
38
38
doc = odml .load (self .outfile )
39
39
self .assertEqual (doc , self .doc )
40
40
41
+ # test style content in saved file
42
+ with open (self .outfile ) as test_file :
43
+ content = test_file .read ()
44
+
45
+ self .assertIn (XML_HEADER , content )
46
+ self .assertIn (EXTERNAL_STYLE_HEADER , content )
47
+
41
48
def test_write_style_default (self ):
42
49
self .writer .write_file (self .outfile , local_style = True )
43
50
44
51
# make sure the file can be read again without errors
45
52
doc = odml .load (self .outfile )
46
53
self .assertEqual (doc , self .doc )
47
54
55
+ # test style content in saved file
56
+ with open (self .outfile ) as test_file :
57
+ content = test_file .read ()
58
+
59
+ self .assertIn (XML_HEADER , content )
60
+ self .assertIn (INFILE_STYLE_HEADER , content )
61
+ self .assertIn (INFILE_STYLE_TEMPLATE , content )
62
+
48
63
def test_write_style_custom (self ):
49
64
# template stub just to see if its written properly; will not render anything
50
65
cust_tmpl = "<xsl:template></xsl:template>"
@@ -55,9 +70,27 @@ def test_write_style_custom(self):
55
70
doc = odml .load (self .outfile )
56
71
self .assertEqual (doc , self .doc )
57
72
58
- # test second possible way to save
73
+ # test style content in saved file
74
+ with open (self .outfile ) as test_file :
75
+ content = test_file .read ()
76
+
77
+ self .assertIn (XML_HEADER , content )
78
+ self .assertIn (INFILE_STYLE_HEADER , content )
79
+ self .assertNotIn (INFILE_STYLE_TEMPLATE , content )
80
+ self .assertIn (cust_tmpl , content )
81
+
82
+ # --- test second possible way to save
59
83
self .writer .write_file (self .outfile , local_style = False , custom_template = cust_tmpl )
60
84
61
85
# make sure the file can be read again without errors
62
86
doc = odml .load (self .outfile )
63
87
self .assertEqual (doc , self .doc )
88
+
89
+ # test style content in saved file
90
+ with open (self .outfile ) as test_file :
91
+ content = test_file .read ()
92
+
93
+ self .assertIn (XML_HEADER , content )
94
+ self .assertIn (INFILE_STYLE_HEADER , content )
95
+ self .assertNotIn (INFILE_STYLE_TEMPLATE , content )
96
+ self .assertIn (cust_tmpl , content )
0 commit comments