Skip to content

Commit 791b9c3

Browse files
Chris HooksChris Hooks
authored andcommitted
Merge remote-tracking branch 'upstream/master'
2 parents c59b4f5 + 3013ed2 commit 791b9c3

29 files changed

+484
-446
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Make sure that your Python installation allows you to run `python` from the comm
3737
4. Click "Next," then "Finish."
3838

3939
### Running the tests
40-
It is possible to run all the tests in one go, or just run one part of the tests to verify a single part of TinCanPython. The tests are located in `TinCanPython/test`.
40+
It is possible to run all the tests in one go, or just run one part of the tests to verify a single part of TinCanPython. The tests are located in `test/`.
4141

4242
#### All the tests:
4343
1. `cd` to the `test` directory.
@@ -53,17 +53,25 @@ It is possible to run all the tests in one go, or just run one part of the tests
5353

5454
(or whatever test you want to run)
5555

56+
#### A single test case of one of the tests:
57+
1. `cd` to the directory containing the test.
58+
2. Run
59+
60+
python -m unittest remote_lrs_test.RemoteLRSTest.test_retrieve_statement
61+
62+
Where "remote_lrs_test" is the test file, "RemoteLRSTest" is the class in that file, and "test_retrieve_statement" is the specific test case.
63+
5664
## API doc generation
57-
To automatically generate documentation, go to the `TinCanPython` folder and run the command
65+
To automatically generate documentation, at the root of the repository run,
5866

5967
sphinx-apidoc -o ./docs/source/ tincan/
6068

61-
Then from the `TinCanPython/docs` folder run
69+
Then from the `docs/` directory run,
6270

6371
make html
6472

65-
The docs will be put in `TinCanPython/docs/build/html/index.html`.
73+
The docs will be output to `docs/build/html/`.
6674

67-
If you would like to change the names of each section, you can do so by modifying `TinCanPython/docs/source/tincan.rst`.
75+
If you would like to change the names of each section, you can do so by modifying `docs/source/tincan.rst`.
6876

6977
## Releasing

test/about_test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#!/usr/bin/env python
2-
31
# Copyright 2014 Rustici Software
42
#
53
# Licensed under the Apache License, Version 2.0 (the "License");

test/activity_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ def test_FromJSONExceptionEmptyObject(self):
7272
def test_AsVersionEmpty(self):
7373
activity = Activity()
7474
activity2 = activity.as_version()
75-
self.assertEqual(activity2, {})
75+
self.assertEqual(activity2, {"objectType": "Activity"})
7676

77-
def test_asVersionNotEmpty(self):
77+
def test_AsVersionNotEmpty(self):
7878
activity = Activity(id='test')
7979
activity2 = activity.as_version()
80-
self.assertEqual(activity2, {'id': 'test'})
80+
self.assertEqual(activity2, {'id': 'test', "objectType": "Activity"})
8181

82-
def test_asVersion(self):
82+
def test_AsVersion(self):
8383
activity = Activity(id='test', definition=ActivityDefinition(), object_type='Activity')
8484
activity2 = activity.as_version()
8585
self.assertEqual(activity2, {'id': 'test', 'definition': {}, 'objectType': 'Activity'})

test/activitylist_test.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ def test_InitEmpty(self):
3535

3636
def test_Init(self):
3737
alist = ActivityList(
38-
[Activity(id='test1'), Activity(id='test2')]
38+
[Activity(id='test1', object_type='Activity'), Activity(id='test2', object_type='Activity')]
3939
)
4040
self.listVerificationHelper(alist)
4141

4242
def test_InitList(self):
43-
a1 = Activity(id='test1')
44-
a2 = Activity(id='test2')
43+
a1 = Activity(id='test1', object_type='Activity')
44+
a2 = Activity(id='test2', object_type='Activity')
4545
alist = ActivityList([a1, a2])
4646
self.listVerificationHelper(alist)
4747

4848
def test_InitActivityList(self):
49-
a1 = Activity(id='test1')
50-
a2 = Activity(id='test2')
49+
a1 = Activity(id='test1', object_type='Activity')
50+
a2 = Activity(id='test2', object_type='Activity')
5151
arg = ActivityList([a1, a2])
5252
alist = ActivityList(arg)
5353
self.listVerificationHelper(alist)
@@ -83,23 +83,23 @@ def test_AsVersionEmpty(self):
8383
self.assertEqual(check, [])
8484

8585
def test_AsVersionNotEmpty(self):
86-
a1 = Activity(id='test1')
87-
a2 = Activity(id='test2')
86+
a1 = Activity(id='test1', object_type='Activity')
87+
a2 = Activity(id='test2', object_type='Activity')
8888
alist = ActivityList([a1, a2])
8989
check = alist.as_version()
9090
self.assertEqual(check,
91-
[{"id": "test1"}, {"id": "test2"}]
91+
[{"id": "test1", "objectType": "Activity"}, {"id": "test2", "objectType": "Activity"}]
9292
)
9393

9494
def test_ToJSONFromJSON(self):
95-
json_str = '[{"id": "test1"}, {"id": "test2"}]'
95+
json_str = '[{"id": "test1", "objectType": "Activity"}, {"id": "test2", "objectType": "Activity"}]'
9696
alist = ActivityList.from_json(json_str)
9797
self.listVerificationHelper(alist)
9898
self.assertEqual(alist.to_json(), json_str)
9999

100100
def test_ToJSON(self):
101101
alist = ActivityList([{"id": "test1"}, {"id": "test2"}])
102-
self.assertEqual(alist.to_json(), '[{"id": "test1"}, {"id": "test2"}]')
102+
self.assertEqual(alist.to_json(), '[{"id": "test1", "objectType": "Activity"}, {"id": "test2", "objectType": "Activity"}]')
103103

104104
def test_setItem(self):
105105
alist = ActivityList([Activity(), Activity()])
@@ -108,16 +108,16 @@ def test_setItem(self):
108108
self.listVerificationHelper(alist)
109109

110110
def test_setItemException(self):
111-
a1 = Activity(id='test1')
112-
a2 = Activity(id='test2')
111+
a1 = Activity(id='test1', object_type='Activity')
112+
a2 = Activity(id='test2', object_type='Activity')
113113
alist = ActivityList([a1, a2])
114114
with self.assertRaises(TypeError):
115115
alist[0] = 'not Activity'
116116
self.listVerificationHelper(alist)
117117

118118
def test_appendItem(self):
119-
a1 = Activity(id='test1')
120-
a2 = Activity(id='test2')
119+
a1 = Activity(id='test1', object_type='Activity')
120+
a2 = Activity(id='test2', object_type='Activity')
121121
alist = ActivityList()
122122
alist.append(a1)
123123
alist.append(a2)
@@ -136,8 +136,8 @@ def test_appendItemCoercion(self):
136136
self.listVerificationHelper(alist)
137137

138138
def test_extend(self):
139-
a1 = Activity(id='test1')
140-
a2 = Activity(id='test2')
139+
a1 = Activity(id='test1', object_type='Activity')
140+
a2 = Activity(id='test2', object_type='Activity')
141141
arglist = ActivityList([a1, a2])
142142
alist = ActivityList([Activity(id='test3')])
143143
alist.extend(arglist)
@@ -147,24 +147,24 @@ def test_extend(self):
147147
self.assertEqual(alist[2].id, 'test2')
148148

149149
def test_extendExceptionNotComponent(self):
150-
a1 = Activity(id='test1')
150+
a1 = Activity(id='test1', object_type='Activity')
151151
arglist = [a1, 'not Activity']
152152
alist = ActivityList([Activity()])
153153
with self.assertRaises(TypeError):
154154
alist.extend(arglist)
155155

156156
def test_insert(self):
157-
a1 = Activity(id='test1')
157+
a1 = Activity(id='test1', object_type='Activity')
158158
a2 = Activity(id='test3')
159159
alist = ActivityList([a1, a2])
160-
alist.insert(1, Activity(id='test2'))
160+
alist.insert(1, Activity(id='test2', object_type='Activity'))
161161
self.assertEqual(len(alist), 3)
162162
self.assertEqual(alist[0].id, 'test1')
163163
self.assertEqual(alist[1].id, 'test2')
164164
self.assertEqual(alist[2].id, 'test3')
165165

166166
def test_insertExceptionNotComponent(self):
167-
a1 = Activity(id='test1')
167+
a1 = Activity(id='test1', object_type='Activity')
168168
a2 = Activity(id='test3')
169169
alist = ActivityList([a1, a2])
170170
with self.assertRaises(TypeError):

0 commit comments

Comments
 (0)