Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

Commit 1b64926

Browse files
committed
Added support for Pyton 3.5
1 parent 424eeda commit 1b64926

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+273
-248
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'tincan/conversions',
88
'tincan/documents',
99
],
10-
version='0.0.5',
10+
version='0.0.5.py.35',
1111
description='A Python library for implementing Tin Can API.',
1212
author='Rustici Software',
1313
author_email='mailto:[email protected]',

test/activity_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
import json
1515
import unittest
1616

1717
if __name__ == '__main__':
@@ -91,12 +91,12 @@ def test_ToJSONFromJSON(self):
9191
check_str = '{"definition": {}, "id": "test", "objectType": "Activity"}'
9292
activity = Activity.from_json(json_str)
9393
self.activityVerificationHelper(activity)
94-
self.assertEqual(activity.to_json(), check_str)
94+
self.assertEqual(json.loads(activity.to_json()), json.loads(check_str))
9595

9696
def test_ToJSON(self):
9797
check_str = '{"definition": {}, "id": "test", "objectType": "Activity"}'
9898
activity = Activity(**{'id': 'test', 'definition': {}, 'object_type': 'Activity'})
99-
self.assertEqual(activity.to_json(), check_str)
99+
self.assertEqual(json.loads(activity.to_json()), json.loads(check_str))
100100

101101
def test_setDefinitionException(self):
102102
activity = Activity()

test/activitydefinition_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
import json
1515
import unittest
1616

1717
if __name__ == '__main__':
@@ -215,7 +215,7 @@ def test_ToJSONIgnoreNone(self):
215215
'description': {'en-US': 'test'},
216216
'more_info': None
217217
})
218-
self.assertEqual(adef.to_json(), '{"description": {"en-US": "test"}}')
218+
self.assertEqual(json.loads(adef.to_json()), json.loads('{"description": {"en-US": "test"}}'))
219219

220220
def test_ToJSONEmpty(self):
221221
adef = ActivityDefinition()

test/activitylist_test.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
import json
1515
import unittest
1616

1717
if __name__ == '__main__':
@@ -93,12 +93,13 @@ def test_ToJSONFromJSON(self):
9393
json_str = '[{"id": "test1", "objectType": "Activity"}, {"id": "test2", "objectType": "Activity"}]'
9494
alist = ActivityList.from_json(json_str)
9595
self.listVerificationHelper(alist)
96-
self.assertEqual(alist.to_json(), json_str)
96+
self.assertEqual(json.loads(alist.to_json()), json.loads(json_str))
9797

9898
def test_ToJSON(self):
9999
alist = ActivityList([{"id": "test1"}, {"id": "test2"}])
100-
self.assertEqual(alist.to_json(),
101-
'[{"id": "test1", "objectType": "Activity"}, {"id": "test2", "objectType": "Activity"}]')
100+
self.assertEqual(json.loads(alist.to_json()),
101+
json.loads(
102+
'[{"id": "test1", "objectType": "Activity"}, {"id": "test2", "objectType": "Activity"}]'))
102103

103104
def test_setItem(self):
104105
alist = ActivityList([Activity(), Activity()])

test/attachment_test.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
import json
1515
import unittest
1616

1717
if __name__ == '__main__':
@@ -301,10 +301,11 @@ def test_ToJSON(self):
301301
attachment = Attachment(
302302
**{"usage_type": "test", "content_type": "test", "length": 1, "sha2": "test", "fileurl": "test",
303303
"display": {"en-US": "test"}, "description": {"en-US": "test"}})
304-
self.assertEqual(attachment.to_json(), ('{"sha2": "test", "contentType": "test", '
305-
'"description": {"en-US": "test"}, '
306-
'"usageType": "test", "length": 1, "fileUrl": "test", '
307-
'"display": {"en-US": "test"}}'))
304+
self.assertEqual(json.loads(attachment.to_json()),
305+
json.loads('{"sha2": "test", "contentType": "test", '
306+
'"description": {"en-US": "test"}, '
307+
'"usageType": "test", "length": 1, "fileUrl": "test", '
308+
'"display": {"en-US": "test"}}'))
308309

309310
def test_ToJSONEmpty(self):
310311
attachment = Attachment()
@@ -322,9 +323,9 @@ def test_ToJSONFromJSON(self):
322323
self.languageMapVerificationHelper(attachment.description)
323324
self.languageMapVerificationHelper(attachment.display)
324325
self.assertEqual(
325-
attachment.to_json(),
326-
'{"sha2": "test", "contentType": "test", "description": {"en-US": "test"}, '
327-
'"usageType": "test", "length": 1, "fileUrl": "test", "display": {"en-US": "test"}}')
326+
json.loads(attachment.to_json()),
327+
json.loads('{"sha2": "test", "contentType": "test", "description": {"en-US": "test"}, '
328+
'"usageType": "test", "length": 1, "fileUrl": "test", "display": {"en-US": "test"}}'))
328329

329330
def languageMapVerificationHelper(self, value):
330331
self.assertIsInstance(value, LanguageMap)

test/documents/activity_profile_document_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def test_activity_setter(self):
152152
doc = ActivityProfileDocument()
153153
doc.activity = {"id": "http://tincanapi.com/TinCanPython/Test/Unit/0"}
154154

155-
self.assertEquals(doc.activity.id, "http://tincanapi.com/TinCanPython/Test/Unit/0")
155+
self.assertEqual(doc.activity.id, "http://tincanapi.com/TinCanPython/Test/Unit/0")
156156

157157

158158
if __name__ == "__main__":

test/documents/state_document_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def test_activity_setter(self):
179179
doc = StateDocument()
180180
doc.activity = {"id": "http://tincanapi.com/TinCanPython/Test/Unit/0"}
181181

182-
self.assertEquals(doc.activity.id, "http://tincanapi.com/TinCanPython/Test/Unit/0")
182+
self.assertEqual(doc.activity.id, "http://tincanapi.com/TinCanPython/Test/Unit/0")
183183

184184

185185
if __name__ == "__main__":

test/group_test.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
import json
1515
import unittest
1616

1717
if __name__ == '__main__':
1818
from main import setup_tincan_path
1919

2020
setup_tincan_path()
21-
from tincan import Group, Agent, AgentAccount
21+
from tincan import Group, Agent
2222

2323

2424
class GroupTest(unittest.TestCase):
2525
def test_InitEmpty(self):
2626
group = Group()
27-
self.assertEquals(group.member, [])
27+
self.assertEqual(group.member, [])
2828

2929
def test_InitObjectType(self):
3030
group = Group(object_type='Group')
@@ -45,7 +45,7 @@ def test_FromJSONExceptionEmpty(self):
4545

4646
def test_FromJSONEmptyObject(self):
4747
group = Group.from_json('{}')
48-
self.assertEquals(group.member, [])
48+
self.assertEqual(group.member, [])
4949

5050
def test_FromJSONmember(self):
5151
group = Group.from_json('''{"member":[{"name":"test"}]}''')
@@ -74,15 +74,15 @@ def test_InitUnpack(self):
7474
def test_ToJSONFromJSON(self):
7575
group = Group.from_json('{"member":[{"name":"test"}, {"name":"test2"}]}')
7676
self.assertIsInstance(group.member[0], Agent)
77-
self.assertEqual(group.to_json(),
78-
'{"member": [{"name": "test", "objectType": "Agent"}, '
79-
'{"name": "test2", "objectType": "Agent"}], "objectType": "Group"}')
77+
self.assertEqual(json.loads(group.to_json()),
78+
json.loads('{"member": [{"name": "test", "objectType": "Agent"}, '
79+
'{"name": "test2", "objectType": "Agent"}], "objectType": "Group"}'))
8080

8181
def test_ToJSON(self):
8282
group = Group(**{'member': [{'name': 'test'}, {'name': 'test2'}]})
83-
self.assertEqual(group.to_json(),
84-
'{"member": [{"name": "test", "objectType": "Agent"}, '
85-
'{"name": "test2", "objectType": "Agent"}], "objectType": "Group"}')
83+
self.assertEqual(json.loads(group.to_json()),
84+
json.loads('{"member": [{"name": "test", "objectType": "Agent"}, '
85+
'{"name": "test2", "objectType": "Agent"}], "objectType": "Group"}'))
8686

8787

8888
if __name__ == '__main__':

test/interactioncomponent_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
import json
1515
import unittest
1616

1717
if __name__ == '__main__':
@@ -138,11 +138,11 @@ def test_ToJSONFromJSON(self):
138138
icomp = InteractionComponent.from_json(json_str)
139139
self.assertEqual(icomp.id, 'test')
140140
self.descriptionVerificationHelper(icomp.description)
141-
self.assertEqual(icomp.to_json(), json_str)
141+
self.assertEqual(json.loads(icomp.to_json()), json.loads(json_str))
142142

143143
def test_ToJSON(self):
144144
icomp = InteractionComponent(**{"id": "test", "description": {"en-US": "test"}})
145-
self.assertEqual(icomp.to_json(), '{"id": "test", "description": {"en-US": "test"}}')
145+
self.assertEqual(json.loads(icomp.to_json()), json.loads('{"id": "test", "description": {"en-US": "test"}}'))
146146

147147
def test_ToJSONIgnoreNoneDescription(self):
148148
icomp = InteractionComponent(id='test')

test/interactioncomponentlist_test.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
14+
import json
1515
import unittest
1616

1717
if __name__ == '__main__':
@@ -95,15 +95,15 @@ def test_ToJSONFromJSON(self):
9595
'{"id": "test2", "description": {"en-US": "test2"}}]'
9696
iclist = InteractionComponentList.from_json(json_str)
9797
self.listVerificationHelper(iclist)
98-
self.assertEqual(iclist.to_json(), json_str)
98+
self.assertEqual(json.loads(iclist.to_json()), json.loads(json_str))
9999

100100
def test_ToJSON(self):
101101
iclist = InteractionComponentList(
102102
[{"id": "test1", "description": {"en-US": "test1"}}, {"id": "test2", "description": {"en-US": "test2"}}])
103103
# since the map is unordered, it is ok that to_json() changes ordering
104-
self.assertEqual(iclist.to_json(),
105-
'[{"id": "test1", "description": {"en-US": "test1"}}, '
106-
'{"id": "test2", "description": {"en-US": "test2"}}]')
104+
self.assertEqual(json.loads(iclist.to_json()),
105+
json.loads('[{"id": "test1", "description": {"en-US": "test1"}}, '
106+
'{"id": "test2", "description": {"en-US": "test2"}}]'))
107107

108108
def test_setItem(self):
109109
iclist = InteractionComponentList([InteractionComponent(), InteractionComponent()])

0 commit comments

Comments
 (0)