|
1 | | -#!/usr/bin/env python |
2 | 1 | # -*- encoding: utf-8 -*- |
3 | 2 |
|
4 | 3 | from datetime import datetime |
5 | 4 |
|
6 | | -from pygithub3.tests.utils.core import TestCase |
| 5 | +from pygithub3.core import json |
7 | 6 | from pygithub3.resources.base import Raw |
| 7 | +from pygithub3.tests.utils.core import TestCase |
8 | 8 | from pygithub3.tests.utils.resources import Nested, Simple, HasSimple |
9 | 9 |
|
10 | 10 | simple_resource = dict(type='simple') |
11 | 11 | has_simple = dict(type='has_simple', simple=simple_resource) |
12 | | -github_return = dict( |
| 12 | +github_dict = dict( |
13 | 13 | id=1, |
14 | 14 | name='name_test', |
15 | 15 | date='2008-01-14T04:33:35Z', |
16 | 16 | simple=simple_resource, |
17 | 17 | list_collection=[has_simple] * 2, |
18 | 18 | items_collections=dict(arg1=has_simple, arg2=has_simple) |
19 | 19 | ) |
20 | | -github_return_nested = github_return.copy() |
21 | | -github_return.update({'self_nested': github_return_nested}) |
22 | | -github_return.update({'self_nested_list': [github_return_nested] * 2}) |
23 | | -github_return.update({'self_nested_dict': dict(arg1=github_return_nested)}) |
| 20 | +github_dict_nested = github_dict.copy() |
| 21 | +github_dict.update({'self_nested': github_dict_nested}) |
| 22 | +github_dict.update({'self_nested_list': [github_dict_nested] * 2}) |
| 23 | +github_dict.update({'self_nested_dict': dict(arg1=github_dict_nested)}) |
| 24 | +github_return = json.dumps(github_dict) |
24 | 25 |
|
25 | 26 |
|
26 | 27 | class TestResourceMapping(TestCase): |
@@ -61,8 +62,7 @@ def test_SELF_nested_in_collections(self): |
61 | 62 |
|
62 | 63 |
|
63 | 64 | class TestRawResource(TestCase): |
64 | | - """ Litle obvious :P """ |
65 | 65 |
|
66 | 66 | def test_return_original_copy(self): |
67 | 67 | self.r = Raw.loads(github_return) |
68 | | - self.assertEqual(id(self.r), id(github_return)) |
| 68 | + self.assertEqual(self.r['id'], github_dict['id']) |
0 commit comments