forked from robert/bashplotlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscatterplot.py
More file actions
50 lines (46 loc) · 1.35 KB
/
scatterplot.py
File metadata and controls
50 lines (46 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Make sure we can include our source code from our test file.
import sys
sys.path.append('../bashplotlib')
from bashplotlib.scatterplot import build_scatter
if __name__ == "__main__":
# Build a scatter plot
scatter = build_scatter(
[-10,20,30],
[-10,20,30],
10,
'x',
'default',
'test hello')
# This is what we know our scatter plot should
# look like. We have to be careful that indentations
# match.
expected_scatter = """----------------------------
| test hello |
----------------------------
----------------------------
| x |
| |
| |
| x |
| |
| |
| |
| |
| |
| |
| |
| x |
----------------------------"""
# Compare what we got to what we expected, and
# fail with a helpful error message if anything is
# different.
if expected_scatter == scatter:
print("SUCCESS!")
sys.exit(0)
else:
print("FAILURE!")
print("Expected:")
print(expected_scatter)
print("Got:")
print(scatter)
sys.exit(1)