-
Notifications
You must be signed in to change notification settings - Fork 0
/
paformat.py
93 lines (77 loc) · 3.09 KB
/
paformat.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# -*- coding: utf-8 -*-
"""
Created on Fri Jul 31 01:51:10 2015
@author: Jamie
"""
TITLE = ''
VERSION = '0.0.0'
AUTHOR = 'Jamie E Paton'
TEST = 0
import sys
import logging
import unittest
import hypothesis as hs
indoor_materials = {'BrickWall' : True,
'CeramicFloor' : True,
'ConcreteFloor' : True,
'ConcreteTiles' : True,
'ConcreteWall' : True,
'Dirt' : False,
'FancyTiles' : True,
'Fence' : False,
'Grass' : False,
'Gravel' : False,
'LongGrass' : False,
'MarbleTiles' : True,
'MetalFloor' : True,
'MosaicFloor' : True,
'Mud' : False,
'PavingStone' : False,
'PerimeterWall' : False,
'Road' : False,
'Sand' : False,
'Stone' : False,
'Water' : False,
'WhiteTiles' : True,
'WoodenFloor' : True}
class Cell(object):
def __init__(self, x, y, material='Dirt', condition=100.0, indoors=False):
self.x = x
self.y = y
self.material = material
self.condition = condition
self.indoors = indoor_materials[self.material]
def __repr__(self):
if self.material != 'Dirt' and self.indoors is not False:
return ' BEGIN "{} {}" Mat {} Con {} Ind {} END'.format(self.x,
self.y,
self.material,
self.condition,
str(self.indoors).lower())
elif self.material != 'Dirt' and self.indoors is False:
return ' BEGIN "{} {}" Mat {} Con {} END'.format(self.x,
self.y,
self.material,
self.condition)
else:
return ' BEGIN "{} {}" Con {} END'.format(self.x,
self.y,
self.condition)
def main(args):
print Cell(67, 41, 'Dirt', condition=88.99933)
print Cell(67, 41, 'ConcreteFloor', condition=88.99933)
class Testing(unittest.TestCase):
"""
Methods
-------
Notes
-----
@given(parameter=hs.strategies.integers())
def test_something(parameter):
assert type(parameter) == int
"""
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
logger.info(''.join([TITLE, ' v', VERSION, ' ', AUTHOR]))
sys.exit(main(sys.argv))