Skip to content

Commit

Permalink
add specificity to test
Browse files Browse the repository at this point in the history
  • Loading branch information
fitnr committed Nov 30, 2017
1 parent 5abbed5 commit 70f1c6c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ def testCliDraw(self):
os.remove('tmp.svg')

def testDrawProjected(self):
self.invoke(['draw', self.dc, '--output', 'tmp.svg', '--precision', '10'])
f = os.path.expanduser('~/tmp.svg')
result = self.invoke(['draw', self.dc, '--output', f, '--precision', '10'])

self.assertEqual(result.exit_code, 0)
self.assertTrue(os.path.exists(f))

try:
with open('tmp.svg') as f:
svg = f.read()
with open(f) as g:
svg = g.read()
match = re.search(r'points="([^"]+)"', svg)
assert match
self.assertIsNotNone(match)

result = match.groups()[0]
points = [[float(x) for x in p.split(',')] for p in result.split(' ')]
Expand All @@ -106,7 +110,7 @@ def testDrawProjected(self):
self.assertAlmostEqual(*z)

finally:
os.remove('tmp.svg')
os.remove(f)

def testCliHelp(self):
result = self.invoke(('--help',))
Expand Down

0 comments on commit 70f1c6c

Please sign in to comment.