Skip to content

Commit f51b263

Browse files
author
api.jscudder
committed
Changed atom.data tests to atom.core tests and added to MANIFEST file.
1 parent 06840c6 commit f51b263

3 files changed

Lines changed: 42 additions & 38 deletions

File tree

MANIFEST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ INSTALL.txt
44
MANIFEST
55
setup.py
66
src/atom/__init__.py
7+
src/atom/core.py
78
src/atom/http.py
89
src/atom/http_interface.py
910
src/atom/mock_http.py
@@ -75,6 +76,7 @@ tests/atom_tests/mock_server_test.py
7576
tests/atom_tests/service_test.py
7677
tests/atom_tests/token_store_test.py
7778
tests/atom_tests/url_test.py
79+
tests/atom_tests/mock_client_test.py
7880
tests/gdata_tests/__init__.py
7981
tests/gdata_tests/apps_test.py
8082
tests/gdata_tests/auth_test.py
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from xml.etree import ElementTree
3030
except ImportError:
3131
from elementtree import ElementTree
32-
import atom.data
32+
import atom.core
3333

3434

3535
SAMPLE_XML = ('<outer xmlns="http://example.com/xml/1" '
@@ -63,15 +63,15 @@
6363
'</alpha>')
6464

6565

66-
class Child(atom.data.XmlElement):
66+
class Child(atom.core.XmlElement):
6767
_qname = ('{http://example.com/1}child', '{http://example.com/2}child')
6868

6969

70-
class Foo(atom.data.XmlElement):
70+
class Foo(atom.core.XmlElement):
7171
_qname = 'foo'
7272

7373

74-
class Example(atom.data.XmlElement):
74+
class Example(atom.core.XmlElement):
7575
_qname = '{http://example.com}foo'
7676
child = Child
7777
foos = [Foo]
@@ -80,33 +80,33 @@ class Example(atom.data.XmlElement):
8080

8181

8282
# Example XmlElement subclass declarations.
83-
class Inner(atom.data.XmlElement):
83+
class Inner(atom.core.XmlElement):
8484
_qname = '{http://example.com/xml/1}inner'
8585
my_x = 'x'
8686

8787

88-
class Outer(atom.data.XmlElement):
88+
class Outer(atom.core.XmlElement):
8989
_qname = '{http://example.com/xml/1}outer'
9090
innards = [Inner]
9191

9292

9393
class XmlElementTest(unittest.TestCase):
9494

9595
def testGetQName(self):
96-
class Unversioned(atom.data.XmlElement):
96+
class Unversioned(atom.core.XmlElement):
9797
_qname = '{http://example.com}foo'
9898

99-
class Versioned(atom.data.XmlElement):
99+
class Versioned(atom.core.XmlElement):
100100
_qname = ('{http://example.com/1}foo', '{http://example.com/2}foo')
101101

102102
self.assert_(
103-
atom.data._get_qname(Unversioned, 1) == '{http://example.com}foo')
103+
atom.core._get_qname(Unversioned, 1) == '{http://example.com}foo')
104104
self.assert_(
105-
atom.data._get_qname(Unversioned, 2) == '{http://example.com}foo')
105+
atom.core._get_qname(Unversioned, 2) == '{http://example.com}foo')
106106
self.assert_(
107-
atom.data._get_qname(Versioned, 1) == '{http://example.com/1}foo')
107+
atom.core._get_qname(Versioned, 1) == '{http://example.com/1}foo')
108108
self.assert_(
109-
atom.data._get_qname(Versioned, 2) == '{http://example.com/2}foo')
109+
atom.core._get_qname(Versioned, 2) == '{http://example.com/2}foo')
110110

111111
def testConstructor(self):
112112
e = Example()
@@ -142,10 +142,10 @@ def testGetElements(self):
142142
e.foos[0].text = 'foo1'
143143
e.foos.append(Foo())
144144
e.foos[1].text = 'foo2'
145-
e._other_elements.append(atom.data.XmlElement())
145+
e._other_elements.append(atom.core.XmlElement())
146146
e._other_elements[0]._qname = 'bar'
147147
e._other_elements[0].text = 'other1'
148-
e._other_elements.append(atom.data.XmlElement())
148+
e._other_elements.append(atom.core.XmlElement())
149149
e._other_elements[1]._qname = 'child'
150150
e._other_elements[1].text = 'other2'
151151

@@ -193,8 +193,8 @@ def testConstructorKwargs(self):
193193
self.assert_(e.tag == 'ok')
194194

195195
def testParseBasicXmlElement(self):
196-
element = atom.data.xml_element_from_string(SAMPLE_XML,
197-
atom.data.XmlElement)
196+
element = atom.core.xml_element_from_string(SAMPLE_XML,
197+
atom.core.XmlElement)
198198
inners = element.get_elements('inner')
199199
self.assert_(len(inners) == 3)
200200
self.assert_(inners[0].get_attributes('x')[0].value == '123')
@@ -216,20 +216,20 @@ def testParseBasicXmlElement(self):
216216
self.assert_(len(inners) == 0)
217217

218218
def testBasicXmlElementPreservesMarkup(self):
219-
element = atom.data.xml_element_from_string(SAMPLE_XML,
220-
atom.data.XmlElement)
219+
element = atom.core.xml_element_from_string(SAMPLE_XML,
220+
atom.core.XmlElement)
221221
tree1 = ElementTree.fromstring(SAMPLE_XML)
222222
tree2 = ElementTree.fromstring(element.to_string())
223223
self.assert_trees_similar(tree1, tree2)
224224

225225
def testSchemaParse(self):
226-
outer = atom.data.xml_element_from_string(SAMPLE_XML, Outer)
226+
outer = atom.core.xml_element_from_string(SAMPLE_XML, Outer)
227227
self.assert_(isinstance(outer.innards, list))
228228
self.assert_(len(outer.innards) == 3)
229229
self.assert_(outer.innards[0].my_x == '123')
230230

231231
def testSchemaParsePreservesMarkup(self):
232-
outer = atom.data.xml_element_from_string(SAMPLE_XML, Outer)
232+
outer = atom.core.xml_element_from_string(SAMPLE_XML, Outer)
233233
tree1 = ElementTree.fromstring(SAMPLE_XML)
234234
tree2 = ElementTree.fromstring(outer.to_string())
235235
self.assert_trees_similar(tree1, tree2)
@@ -262,41 +262,41 @@ def assert_trees_similar(self, a, b):
262262
class UtilityFunctionTest(unittest.TestCase):
263263

264264
def testMatchQnames(self):
265-
self.assert_(atom.data._qname_matches(
265+
self.assert_(atom.core._qname_matches(
266266
'foo', 'http://example.com', '{http://example.com}foo'))
267-
self.assert_(atom.data._qname_matches(
267+
self.assert_(atom.core._qname_matches(
268268
None, None, '{http://example.com}foo'))
269-
self.assert_(atom.data._qname_matches(
269+
self.assert_(atom.core._qname_matches(
270270
None, None, 'foo'))
271-
self.assert_(atom.data._qname_matches(
271+
self.assert_(atom.core._qname_matches(
272272
None, None, None))
273-
self.assert_(atom.data._qname_matches(
273+
self.assert_(atom.core._qname_matches(
274274
None, None, '{http://example.com}'))
275-
self.assert_(atom.data._qname_matches(
275+
self.assert_(atom.core._qname_matches(
276276
'foo', None, '{http://example.com}foo'))
277-
self.assert_(atom.data._qname_matches(
277+
self.assert_(atom.core._qname_matches(
278278
None, 'http://example.com', '{http://example.com}foo'))
279-
self.assert_(atom.data._qname_matches(
279+
self.assert_(atom.core._qname_matches(
280280
None, '', 'foo'))
281-
self.assert_(atom.data._qname_matches(
281+
self.assert_(atom.core._qname_matches(
282282
'foo', '', 'foo'))
283-
self.assert_(atom.data._qname_matches(
283+
self.assert_(atom.core._qname_matches(
284284
'foo', '', 'foo'))
285-
self.assert_(atom.data._qname_matches(
285+
self.assert_(atom.core._qname_matches(
286286
'foo', 'http://google.com', '{http://example.com}foo') == False)
287-
self.assert_(atom.data._qname_matches(
287+
self.assert_(atom.core._qname_matches(
288288
'foo', 'http://example.com', '{http://example.com}bar') == False)
289-
self.assert_(atom.data._qname_matches(
289+
self.assert_(atom.core._qname_matches(
290290
'foo', 'http://example.com', '{http://google.com}foo') == False)
291-
self.assert_(atom.data._qname_matches(
291+
self.assert_(atom.core._qname_matches(
292292
'bar', 'http://example.com', '{http://google.com}foo') == False)
293-
self.assert_(atom.data._qname_matches(
293+
self.assert_(atom.core._qname_matches(
294294
'foo', None, '{http://example.com}bar') == False)
295-
self.assert_(atom.data._qname_matches(
295+
self.assert_(atom.core._qname_matches(
296296
None, 'http://google.com', '{http://example.com}foo') == False)
297-
self.assert_(atom.data._qname_matches(
297+
self.assert_(atom.core._qname_matches(
298298
None, '', '{http://example.com}foo') == False)
299-
self.assert_(atom.data._qname_matches(
299+
self.assert_(atom.core._qname_matches(
300300
'foo', '', 'bar') == False)
301301

302302

tests/run_data_tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import atom_tests.mock_http_test
1313
import atom_tests.token_store_test
1414
import atom_tests.url_test
15+
import atom_tests.core_test
1516
import gdata_tests.apps_test
1617
import gdata_tests.auth_test
1718
import gdata_tests.base_test
@@ -32,6 +33,7 @@ def RunAllTests():
3233
test_runner.modules = [gdata_test, atom_test, atom_tests.url_test,
3334
atom_tests.http_interface_test,
3435
atom_tests.mock_http_test,
36+
atom_tests.core_test,
3537
atom_tests.token_store_test,
3638
gdata_tests.client_test,
3739
gdata_tests.apps_test, gdata_tests.auth_test,

0 commit comments

Comments
 (0)