Skip to content

Commit 4b20bd9

Browse files
committed
Updated unittests
1 parent 9c52541 commit 4b20bd9

2 files changed

Lines changed: 19 additions & 20 deletions

File tree

unittests/test_core.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
# Insert the location of makeprojects at the begining so it's the first
2424
# to be processed
2525
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
26-
from makeprojects.core import Attributes, Configuration, Project, Solution
26+
2727
from makeprojects.enums import PlatformTypes, ProjectTypes, IDETypes
28+
from makeprojects.core import Attributes, Configuration, Project, Solution
2829

2930
########################################
3031

@@ -158,13 +159,12 @@ def test_attributes(self):
158159
# test use_mfc
159160
self.assertIsNone(a.use_mfc)
160161
a.use_mfc = "true"
161-
self.assertIs(a.use_mfc, True)
162+
with self.assertRaises(ValueError):
163+
a.use_mfc = True
162164
a.use_mfc = "false"
163-
self.assertIs(a.use_mfc, False)
164-
a.use_mfc = False
165-
self.assertIs(a.use_mfc, False)
166165
with self.assertRaises(ValueError):
167-
a.use_mfc = "anchovy"
166+
a.use_mfc = False
167+
a.use_mfc = "anchovy"
168168
with self.assertRaises(ValueError):
169169
a.use_mfc = self
170170
a.use_mfc = None
@@ -173,13 +173,12 @@ def test_attributes(self):
173173
# test use_mfc
174174
self.assertIsNone(a.use_atl)
175175
a.use_atl = "true"
176-
self.assertIs(a.use_atl, True)
177176
a.use_atl = "false"
178-
self.assertIs(a.use_atl, False)
179-
a.use_atl = False
180-
self.assertIs(a.use_atl, False)
181177
with self.assertRaises(ValueError):
182-
a.use_atl = "garden"
178+
a.use_atl = True
179+
with self.assertRaises(ValueError):
180+
a.use_atl = False
181+
a.use_atl = "garden"
183182
with self.assertRaises(ValueError):
184183
a.use_atl = self
185184
a.use_atl = None
@@ -188,13 +187,13 @@ def test_attributes(self):
188187
# test clr_support
189188
self.assertIsNone(a.clr_support)
190189
a.clr_support = "true"
191-
self.assertIs(a.clr_support, True)
190+
with self.assertRaises(ValueError):
191+
a.clr_support = True
192192
a.clr_support = "n"
193-
self.assertIs(a.clr_support, False)
194-
a.clr_support = False
195-
self.assertIs(a.clr_support, False)
196193
with self.assertRaises(ValueError):
197-
a.clr_support = "elvis"
194+
a.clr_support = False
195+
with self.assertRaises(ValueError):
196+
a.clr_support = 99
198197
with self.assertRaises(ValueError):
199198
a.clr_support = self
200199
a.clr_support = None

unittests/test_visualstudio.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,14 @@ def test_vs2003xml(self):
6565
'<VisualStudioProject>\n</VisualStudioProject>')
6666

6767
# Entry with only attributes
68-
vs_project.add_default(VSStringProperty('ProjectType', 'Visual C++'))
68+
vs_project.add_attribute(VSStringProperty('ProjectType', 'Visual C++'))
6969
self.assertEqual(str(vs_project), (
7070
'<VisualStudioProject\n'
7171
'\tProjectType="Visual C++"\n/>'))
7272

7373
# Test a second element
7474
platform = VS2003XML('Platform')
75-
platform.add_default(VSStringProperty('Name', 'Win32'))
75+
platform.add_attribute(VSStringProperty('Name', 'Win32'))
7676
self.assertEqual(str(platform), '<Platform\n\tName="Win32"\n/>')
7777

7878
# Test an element in an element
@@ -85,7 +85,7 @@ def test_vs2003xml(self):
8585
'</VisualStudioProject>'))
8686

8787
# Test with element in an element with attributes
88-
vs_project.add_default(VSStringProperty('ProjectType', 'Visual C++'))
88+
vs_project.add_attribute(VSStringProperty('ProjectType', 'Visual C++'))
8989
self.assertEqual(str(vs_project), (
9090
'<VisualStudioProject\n'
9191
'\tProjectType="Visual C++"\n\t>\n'
@@ -101,7 +101,7 @@ def test_vs2003xml(self):
101101
'\t\tName="Win32"\n\t/>\n'
102102
'</VisualStudioProject>'))
103103

104-
vs_project.add_default(VSStringProperty('ProjectGUID', 'GUID'))
104+
vs_project.add_attribute(VSStringProperty('ProjectGUID', 'GUID'))
105105
self.assertEqual(str(vs_project), (
106106
'<VisualStudioProject\n'
107107
'\tProjectType="Visual C"\n'

0 commit comments

Comments
 (0)