Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
a03a11e0
Commit
a03a11e0
authored
Oct 08, 2013
by
Ned Batchelder
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1253 from edx/ned/use-assertisinstance
Use assertIsInstance where we can
parents
560dac6a
a4bf549a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
17 deletions
+17
-17
cms/djangoapps/contentstore/tests/test_contentstore.py
+1
-1
common/djangoapps/service_status/test.py
+2
-2
common/lib/xmodule/xmodule/tests/test_annotatable_module.py
+4
-4
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
+3
-3
common/lib/xmodule/xmodule/tests/test_error_module.py
+4
-4
lms/djangoapps/bulk_email/tests/test_err_handling.py
+3
-3
No files found.
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
a03a11e0
...
...
@@ -792,7 +792,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
source_location
.
tag
,
source_location
.
org
,
source_location
.
course
,
'html'
,
'nonportable'
])
html_module
=
module_store
.
get_instance
(
source_location
.
course_id
,
html_module_location
)
self
.
assert
True
(
isinstance
(
html_module
.
data
,
basestring
)
)
self
.
assert
IsInstance
(
html_module
.
data
,
basestring
)
new_data
=
html_module
.
data
.
replace
(
'/static/'
,
'/c4x/{0}/{1}/asset/'
.
format
(
source_location
.
org
,
source_location
.
course
))
module_store
.
update_item
(
html_module_location
,
new_data
)
...
...
common/djangoapps/service_status/test.py
View file @
a03a11e0
...
...
@@ -42,6 +42,6 @@ class CeleryConfigTest(unittest.TestCase):
# We don't know the other dict values exactly,
# but we can assert that they take the right form
self
.
assert
True
(
isinstance
(
result_dict
[
'task_id'
],
unicode
)
)
self
.
assert
True
(
isinstance
(
result_dict
[
'time'
],
float
)
)
self
.
assert
IsInstance
(
result_dict
[
'task_id'
],
unicode
)
self
.
assert
IsInstance
(
result_dict
[
'time'
],
float
)
self
.
assertTrue
(
result_dict
[
'time'
]
>
0.0
)
common/lib/xmodule/xmodule/tests/test_annotatable_module.py
View file @
a03a11e0
...
...
@@ -52,7 +52,7 @@ class AnnotatableModuleTestCase(unittest.TestCase):
actual_attr
=
self
.
annotatable
.
_get_annotation_data_attr
(
0
,
el
)
self
.
assert
True
(
type
(
actual_attr
)
is
dict
)
self
.
assert
IsInstance
(
actual_attr
,
dict
)
self
.
assertDictEqual
(
expected_attr
,
actual_attr
)
def
test_annotation_class_attr_default
(
self
):
...
...
@@ -62,7 +62,7 @@ class AnnotatableModuleTestCase(unittest.TestCase):
expected_attr
=
{
'class'
:
{
'value'
:
'annotatable-span highlight'
}
}
actual_attr
=
self
.
annotatable
.
_get_annotation_class_attr
(
0
,
el
)
self
.
assert
True
(
type
(
actual_attr
)
is
dict
)
self
.
assert
IsInstance
(
actual_attr
,
dict
)
self
.
assertDictEqual
(
expected_attr
,
actual_attr
)
def
test_annotation_class_attr_with_valid_highlight
(
self
):
...
...
@@ -78,7 +78,7 @@ class AnnotatableModuleTestCase(unittest.TestCase):
}
actual_attr
=
self
.
annotatable
.
_get_annotation_class_attr
(
0
,
el
)
self
.
assert
True
(
type
(
actual_attr
)
is
dict
)
self
.
assert
IsInstance
(
actual_attr
,
dict
)
self
.
assertDictEqual
(
expected_attr
,
actual_attr
)
def
test_annotation_class_attr_with_invalid_highlight
(
self
):
...
...
@@ -92,7 +92,7 @@ class AnnotatableModuleTestCase(unittest.TestCase):
}
actual_attr
=
self
.
annotatable
.
_get_annotation_class_attr
(
0
,
el
)
self
.
assert
True
(
type
(
actual_attr
)
is
dict
)
self
.
assert
IsInstance
(
actual_attr
,
dict
)
self
.
assertDictEqual
(
expected_attr
,
actual_attr
)
def
test_render_annotation
(
self
):
...
...
common/lib/xmodule/xmodule/tests/test_combined_open_ended.py
View file @
a03a11e0
...
...
@@ -769,10 +769,10 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
self
.
assertEqual
(
module
.
current_task_number
,
0
)
html
=
module
.
get_html
()
self
.
assert
True
(
isinstance
(
html
,
basestring
)
)
self
.
assert
IsInstance
(
html
,
basestring
)
rubric
=
module
.
handle_ajax
(
"get_combined_rubric"
,
{})
self
.
assert
True
(
isinstance
(
rubric
,
basestring
)
)
self
.
assert
IsInstance
(
rubric
,
basestring
)
self
.
assertEqual
(
module
.
state
,
"assessing"
)
module
.
handle_ajax
(
"reset"
,
{})
self
.
assertEqual
(
module
.
current_task_number
,
0
)
...
...
@@ -790,7 +790,7 @@ class OpenEndedModuleXmlTest(unittest.TestCase, DummyModulestore):
#Simulate a student saving an answer
module
.
handle_ajax
(
"save_answer"
,
{
"student_answer"
:
self
.
answer
})
status
=
module
.
handle_ajax
(
"get_status"
,
{})
self
.
assert
True
(
isinstance
(
status
,
basestring
)
)
self
.
assert
IsInstance
(
status
,
basestring
)
#Mock a student submitting an assessment
assessment_dict
=
MockQueryDict
()
...
...
common/lib/xmodule/xmodule/tests/test_error_module.py
View file @
a03a11e0
...
...
@@ -29,7 +29,7 @@ class TestErrorModule(unittest.TestCase, SetupTestErrorModules):
def
test_error_module_xml_rendering
(
self
):
descriptor
=
error_module
.
ErrorDescriptor
.
from_xml
(
self
.
valid_xml
,
self
.
system
,
self
.
org
,
self
.
course
,
self
.
error_msg
)
self
.
assert
True
(
isinstance
(
descriptor
,
error_module
.
ErrorDescriptor
)
)
self
.
assert
IsInstance
(
descriptor
,
error_module
.
ErrorDescriptor
)
module
=
descriptor
.
xmodule
(
self
.
system
)
context_repr
=
module
.
get_html
()
self
.
assertIn
(
self
.
error_msg
,
context_repr
)
...
...
@@ -43,7 +43,7 @@ class TestErrorModule(unittest.TestCase, SetupTestErrorModules):
error_descriptor
=
error_module
.
ErrorDescriptor
.
from_descriptor
(
descriptor
,
self
.
error_msg
)
self
.
assert
True
(
isinstance
(
error_descriptor
,
error_module
.
ErrorDescriptor
)
)
self
.
assert
IsInstance
(
error_descriptor
,
error_module
.
ErrorDescriptor
)
module
=
error_descriptor
.
xmodule
(
self
.
system
)
context_repr
=
module
.
get_html
()
self
.
assertIn
(
self
.
error_msg
,
context_repr
)
...
...
@@ -60,7 +60,7 @@ class TestNonStaffErrorModule(unittest.TestCase, SetupTestErrorModules):
def
test_non_staff_error_module_create
(
self
):
descriptor
=
error_module
.
NonStaffErrorDescriptor
.
from_xml
(
self
.
valid_xml
,
self
.
system
,
self
.
org
,
self
.
course
)
self
.
assert
True
(
isinstance
(
descriptor
,
error_module
.
NonStaffErrorDescriptor
)
)
self
.
assert
IsInstance
(
descriptor
,
error_module
.
NonStaffErrorDescriptor
)
def
test_from_xml_render
(
self
):
descriptor
=
error_module
.
NonStaffErrorDescriptor
.
from_xml
(
...
...
@@ -78,7 +78,7 @@ class TestNonStaffErrorModule(unittest.TestCase, SetupTestErrorModules):
error_descriptor
=
error_module
.
NonStaffErrorDescriptor
.
from_descriptor
(
descriptor
,
self
.
error_msg
)
self
.
assert
True
(
isinstance
(
error_descriptor
,
error_module
.
ErrorDescriptor
)
)
self
.
assert
IsInstance
(
error_descriptor
,
error_module
.
ErrorDescriptor
)
module
=
error_descriptor
.
xmodule
(
self
.
system
)
context_repr
=
module
.
get_html
()
self
.
assertNotIn
(
self
.
error_msg
,
context_repr
)
...
...
lms/djangoapps/bulk_email/tests/test_err_handling.py
View file @
a03a11e0
...
...
@@ -61,7 +61,7 @@ class TestEmailErrors(ModuleStoreTestCase):
self
.
assertTrue
(
retry
.
called
)
(
_
,
kwargs
)
=
retry
.
call_args
exc
=
kwargs
[
'exc'
]
self
.
assert
True
(
type
(
exc
)
==
SMTPDataError
)
self
.
assert
IsInstance
(
exc
,
SMTPDataError
)
@patch
(
'bulk_email.tasks.get_connection'
,
autospec
=
True
)
@patch
(
'bulk_email.tasks.course_email_result'
)
...
...
@@ -110,7 +110,7 @@ class TestEmailErrors(ModuleStoreTestCase):
self
.
assertTrue
(
retry
.
called
)
(
_
,
kwargs
)
=
retry
.
call_args
exc
=
kwargs
[
'exc'
]
self
.
assert
True
(
type
(
exc
)
==
SMTPServerDisconnected
)
self
.
assert
IsInstance
(
exc
,
SMTPServerDisconnected
)
@patch
(
'bulk_email.tasks.get_connection'
,
autospec
=
True
)
@patch
(
'bulk_email.tasks.course_email.retry'
)
...
...
@@ -131,7 +131,7 @@ class TestEmailErrors(ModuleStoreTestCase):
self
.
assertTrue
(
retry
.
called
)
(
_
,
kwargs
)
=
retry
.
call_args
exc
=
kwargs
[
'exc'
]
self
.
assert
True
(
type
(
exc
)
==
SMTPConnectError
)
self
.
assert
IsInstance
(
exc
,
SMTPConnectError
)
@patch
(
'bulk_email.tasks.course_email_result'
)
@patch
(
'bulk_email.tasks.course_email.retry'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment