Skip to content

Commit dd5d67a

Browse files
committed
add output to the bottom of the specification.py and adaptation with python2.7
1 parent ab9de61 commit dd5d67a

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

specification.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,19 @@
88
chaining together using boolean logic
99
"""
1010

11-
from abc import ABCMeta, abstractmethod
11+
from abc import abstractmethod
1212

1313

14-
class Specification:
15-
__metaclass__ = ABCMeta
14+
class Specification(object):
1615

1716
def and_specification(self, candidate):
18-
raise NotImplementedError
17+
raise NotImplementedError()
1918

2019
def or_specification(self, candidate):
21-
raise NotImplementedError
20+
raise NotImplementedError()
2221

2322
def not_specification(self):
24-
raise NotImplementedError
23+
raise NotImplementedError()
2524

2625
@abstractmethod
2726
def is_satisfied_by(self, candidate):
@@ -101,10 +100,18 @@ def is_satisfied_by(self, candidate):
101100
print('Specification')
102101
andrey = User()
103102
ivan = User(super_user=True)
103+
vasiliy = 'not User instance'
104104

105105
root_specification = UserSpecification().\
106106
and_specification(SuperUserSpecification())
107107

108108
print(root_specification.is_satisfied_by(andrey))
109109
print(root_specification.is_satisfied_by(ivan))
110+
print(root_specification.is_satisfied_by(vasiliy))
110111

112+
113+
### OUTPUT ###
114+
# Specification
115+
# False
116+
# True
117+
# False

0 commit comments

Comments
 (0)