function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def mock_get_no2_returning_no2index_around_coords(self, params_dict):
return json.loads(NO2INDEX_JSON) | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def mock_get_forecast_air_pollution(self, params_dict):
return json.loads(AIRSTATUS_MULTIPLE_JSON) | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def mock_get_so2_returning_so2index_around_coords(self, params_dict):
return json.loads(SO2INDEX_JSON) | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def test_get_uvindex_api_version(self):
result = self.__test_instance.airpollution_api_version()
self.assertIsInstance(result, tuple)
self.assertEqual(result, AIRPOLLUTION_API_VERSION) | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def test_coindex_around_coords_fails_with_wrong_parameters(self):
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.coindex_around_coords, \
self.__test_instance, 43.7, -200.0)
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.coindex_a... | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def test_ozone_around_coords_fails_with_wrong_parameters(self):
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.ozone_around_coords, \
self.__test_instance, 43.7, -200.0)
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.ozone_around_... | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def test_no2index_around_coords_fails_with_wrong_parameters(self):
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.no2index_around_coords, \
self.__test_instance, 43.7, -200.0)
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.no2inde... | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def test_so2index_around_coords_fails_with_wrong_parameters(self):
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.so2index_around_coords, \
self.__test_instance, 43.7, -200.0)
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.so2inde... | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def test_air_quality_at_coords_fails_with_wrong_parameters(self):
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.air_quality_at_coords, \
self.__test_instance, 43.7, -200.0)
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.air_quali... | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def test_air_quality_forecast_at_coords_fails_with_wrong_parameters(self):
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.air_quality_forecast_at_coords, \
self.__test_instance, 43.7, -200.0)
self.assertRaises(ValueError, airpollution_manager.AirPollutio... | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def test_air_quality_history_at_coords_fails_with_wrong_parameters(self):
self.assertRaises(ValueError, airpollution_manager.AirPollutionManager.air_quality_history_at_coords, \
self.__test_instance, 43.7, -200.0, 12345678, 12349999)
self.assertRaises(ValueError, airpollution_m... | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def assert_clipped(obj, params_dict):
self.assertEqual(params_dict['end'], now) | csparpa/pyowm | [
746,
159,
746,
16,
1378111431
] |
def _get_proxy(obj, get_only=True):
class Proxy(object):
def __getattr__(self, name):
return getattr(obj, name)
if not get_only:
def __setattr__(self, name, value):
setattr(obj, name, value)
def __delattr__(self, name):
delattr(obj, name)
Proxy... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def __init__(self, a):
pass | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def g(self):
pass | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def a(self):
pass | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def function(a, b=Foo):
pass | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def __init__(self):
self.values = {} | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def __setitem__(self, name, value):
self.values[name] = value | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def __iter__(self):
return iter(self.values) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def assertNotCallable(self, obj, magic=True):
MockClass = NonCallableMagicMock
if not magic:
MockClass = NonCallableMock
self.assertRaises(TypeError, obj)
self.assertTrue(is_instance(obj, MockClass))
self.assertFalse(is_instance(obj, CallableMixin)) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(Something.attribute, sentinel.Patched, "unpatched") | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patchobject_with_none(self):
class Something(object):
attribute = sentinel.Original
@patch.object(Something, 'attribute', None)
def test():
self.assertIsNone(Something.attribute, "unpatched")
test()
self.assertEqual(Something.attribute, sentinel... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(Something.attribute, sentinel.Patched,
"unpatched")
self.assertEqual(Something.next_attribute, sentinel.Patched2,
"unpatched") | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_object_lookup_is_quite_lazy(self):
global something
original = something
@patch('%s.something' % __name__, sentinel.Something2)
def test():
pass
try:
something = sentinel.replacement_value
test()
self.assertEqual(something... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(PTModule.something, sentinel.Something2,
"unpatched") | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(PTModule.something, sentinel.Something2,
"unpatched")
self.assertEqual(PTModule.something_else, sentinel.SomethingElse,
"unpatched") | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(open('filename', 'r'), sentinel.Handle,
"open not patched") | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_class_attribute(self):
@patch('%s.SomeClass.class_attribute' % __name__,
sentinel.ClassAttribute)
def test():
self.assertEqual(PTModule.SomeClass.class_attribute,
sentinel.ClassAttribute, "unpatched")
test()
self.ass... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(mock):
self.assertEqual(mock, Test.something,
"Mock not passed into test function")
self.assertIsInstance(mock, MagicMock,
"patch with two arguments did not create a mock") | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(this1, this2, mock1, mock2):
self.assertEqual(this1, sentinel.this1,
"Patched function didn't receive initial argument")
self.assertEqual(this2, sentinel.this2,
"Patched function didn't receive second argument")
self.... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_with_spec(self):
@patch('%s.SomeClass' % __name__, spec=SomeClass)
def test(MockSomeClass):
self.assertEqual(SomeClass, MockSomeClass)
self.assertTrue(is_instance(SomeClass.wibble, MagicMock))
self.assertRaises(AttributeError, lambda: SomeClass.not_wibb... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(MockAttribute):
self.assertEqual(SomeClass.class_attribute, MockAttribute)
self.assertTrue(is_instance(SomeClass.class_attribute.wibble,
MagicMock))
self.assertRaises(AttributeError,
lambda: SomeClass.class... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_with_spec_as_list(self):
@patch('%s.SomeClass' % __name__, spec=['wibble'])
def test(MockSomeClass):
self.assertEqual(SomeClass, MockSomeClass)
self.assertTrue(is_instance(SomeClass.wibble, MagicMock))
self.assertRaises(AttributeError, lambda: SomeClass... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(MockAttribute):
self.assertEqual(SomeClass.class_attribute, MockAttribute)
self.assertTrue(is_instance(SomeClass.class_attribute.wibble,
MagicMock))
self.assertRaises(AttributeError,
lambda: SomeClass.class... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_nested_patch_with_spec_as_list(self):
# regression test for nested decorators
@patch('%s.open' % builtin_string)
@patch('%s.SomeClass' % __name__, spec=['wibble'])
def test(MockSomeClass, MockOpen):
self.assertEqual(SomeClass, MockSomeClass)
self.assertTr... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(MockSomeClass):
self.assertEqual(SomeClass, MockSomeClass)
# Should not raise attribute error
MockSomeClass.wibble
self.assertRaises(AttributeError, lambda: MockSomeClass.not_wibble) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_object_with_spec_as_boolean(self):
@patch.object(PTModule, 'SomeClass', spec=True)
def test(MockSomeClass):
self.assertEqual(SomeClass, MockSomeClass)
# Should not raise attribute error
MockSomeClass.wibble
self.assertRaises(AttributeError,... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(MockSomeClass):
self.assertTrue(is_instance(MockSomeClass, MagicMock))
instance = MockSomeClass()
self.assertNotCallable(instance)
# Should not raise attribute error
instance.wibble
self.assertRaises(AttributeError, lambda: instance.not_w... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_with_create_mocks_non_existent_attributes(self):
@patch('%s.frooble' % builtin_string, sentinel.Frooble, create=True)
def test():
self.assertEqual(frooble, sentinel.Frooble)
test()
self.assertRaises(NameError, lambda: frooble) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(SomeClass.frooble, sentinel.Frooble) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_wont_create_by_default(self):
try:
@patch('%s.frooble' % builtin_string, sentinel.Frooble)
def test():
self.assertEqual(frooble, sentinel.Frooble)
test()
except AttributeError:
pass
else:
self.fail('Patch... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.fail('Patching non existent attributes should fail') | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_builtins_without_create(self):
@patch(__name__+'.ord')
def test_ord(mock_ord):
mock_ord.return_value = 101
return ord('c')
@patch(__name__+'.open')
def test_open(mock_open):
m = mock_open.return_value
m.read.return_value = '... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def woot():
return sentinel.Static | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def anonymous():
self.assertEqual(Foo.woot(), sentinel.Patched) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_local(self):
foo = sentinel.Foo
@patch.object(sentinel, 'Foo', 'Foo')
def anonymous():
self.assertEqual(sentinel.Foo, 'Foo')
anonymous()
self.assertEqual(sentinel.Foo, foo) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def anonymous():
self.assertEqual(foo.Foo, 'Foo') | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patchobject_class_decorator(self):
class Something(object):
attribute = sentinel.Original
class Foo(object):
def test_method(other_self):
self.assertEqual(Something.attribute, sentinel.Patched,
"unpatched")
de... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_method(other_self, mock_something):
self.assertEqual(PTModule.something, mock_something,
"unpatched") | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patchobject_twice(self):
class Something(object):
attribute = sentinel.Original
next_attribute = sentinel.Original2
@patch.object(Something, 'attribute', sentinel.Patched)
@patch.object(Something, 'attribute', sentinel.Patched)
def test():
se... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
foo['a'] = 3
del foo['initial']
foo['other'] = 'something else' | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(len(foo), 3)
self.assertEqual(foo['a'], 'b') | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(len(foo), 3)
self.assertEqual(foo['a'], 'b') | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_dict_with_container_object(self):
foo = Container()
foo['initial'] = object()
foo['other'] = 'something'
original = foo.values.copy()
@patch.dict(foo)
def test():
foo['a'] = 3
del foo['initial']
foo['other'] = 'somethi... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(foo, {})
foo['a'] = 3
foo['other'] = 'something else' | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(foo, {'a': 'b'}) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(foo, {'a': 'b'}) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_dict_with_container_object_and_clear(self):
foo = Container()
foo['initial'] = object()
foo['other'] = 'something'
original = foo.values.copy()
@patch.dict(foo, clear=True)
def test():
self.assertEqual(foo.values, {})
foo['a'] = 3... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def some_name():
pass | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_with_exception(self):
foo = {}
@patch.dict(foo, {'a': 'b'})
def test():
raise NameError('Konrad')
try:
test()
except NameError:
pass
else:
self.fail('NameError not raised by test')
self.assertEqual(f... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertIn('konrad_delong', os.environ) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_descriptor(self):
# would be some effort to fix this - we could special case the
# builtin descriptors: classmethod, property, staticmethod
return
class Nothing(object):
foo = None
class Something(object):
foo = {}
@patch.objec... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(MockClass):
MockClass.z = 'foo' | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(MockClass):
MockClass.z = 'foo' | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(MockClass):
MockClass.z = 'foo' | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(MockClass):
MockClass.z = 'foo' | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_spec_set_inherit(self):
@patch('%s.SomeClass' % __name__, spec_set=True)
def test(MockClass):
instance = MockClass()
instance.z = 'foo'
self.assertRaises(AttributeError, test) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_stop_without_start(self):
patcher = patch(foo_name, 'bar', 3)
# calling stop without start used to produce a very obscure error
self.assertRaises(RuntimeError, patcher.stop) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_dict_start_stop(self):
d = {'foo': 'bar'}
original = d.copy()
patcher = patch.dict(d, [('spam', 'eggs')], clear=True)
self.assertEqual(d, original)
patcher.start()
try:
self.assertEqual(d, {'spam': 'eggs'})
finally:
patcher.... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_first(self):
this.assertEqual(d, {'foo': 'bar'}) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_get_only_proxy(self):
class Something(object):
foo = 'foo'
class SomethingElse:
foo = 'foo'
for thing in Something, SomethingElse, Something(), SomethingElse:
proxy = _get_proxy(thing)
@patch.object(proxy, 'foo', 'bar')
def t... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertEqual(proxy.foo, 'bar') | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_keyword_args(self):
kwargs = {'side_effect': KeyError, 'foo.bar.return_value': 33,
'foo': MagicMock()}
patcher = patch(foo_name, **kwargs)
mock = patcher.start()
patcher.stop()
self.assertRaises(KeyError, mock)
self.assertEqual(mock.foo.... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_dict_keyword_args(self):
original = {'foo': 'bar'}
copy = original.copy()
patcher = patch.dict(original, foo=3, bar=4, baz=5)
patcher.start()
try:
self.assertEqual(original, dict(foo=3, bar=4, baz=5))
finally:
patcher.stop()
... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def __init__(self, a):
pass | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def g(self):
pass | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def a(self):
pass | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def _test2(mock):
mock.f(1)
mock.f.assert_called_with(1)
self.assertRaises(TypeError, mock.f)
mock.g()
mock.g.assert_called_with()
self.assertRaises(TypeError, mock.g, 1)
self.assertRaises(AttributeError, getattr, mock, 'h')
... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_autospec_function(self):
@patch('%s.function' % __name__, autospec=True)
def test(mock):
function.assert_not_called()
self.assertRaises(AssertionError, function.assert_called)
self.assertRaises(AssertionError, function.assert_called_once)
function... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(mock_function):
#self.assertEqual(function.abc, 'foo')
return function(1, 2) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_autospec_with_new(self):
patcher = patch('%s.function' % __name__, new=3, autospec=True)
self.assertRaises(TypeError, patcher.start)
module = sys.modules[__name__]
patcher = patch.object(module, 'function', new=3, autospec=True)
self.assertRaises(TypeError, patcher.star... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_autospec_inherits(self):
FooClass = Foo
patcher = patch(foo_name, autospec=True)
mock = patcher.start()
try:
self.assertIsInstance(mock, FooClass)
self.assertIsInstance(mock(3), FooClass)
finally:
patcher.stop() | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_tracebacks(self):
@patch.object(Foo, 'f', object())
def test():
raise AssertionError
try:
test()
except:
err = sys.exc_info()
result = unittest.TextTestResult(None, None, 0)
traceback = result._exc_info_to_string(err, self)
... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_new_callable_patch_object(self):
patcher = patch.object(Foo, 'f', new_callable=NonCallableMagicMock)
m1 = patcher.start()
patcher.stop()
m2 = patcher.start()
patcher.stop()
self.assertIsNot(m1, m2)
for mock in m1, m2:
self.assertNotCallable(... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def __init__(self, **kwargs):
Bar.kwargs = kwargs | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_new_callable_spec(self):
class Bar(object):
kwargs = None
def __init__(self, **kwargs):
Bar.kwargs = kwargs
patcher = patch(foo_name, new_callable=Bar, spec=Bar)
patcher.start()
try:
self.assertEqual(Bar.kwargs, dict(spec=Bar)... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_new_callable_incompatible_with_new(self):
self.assertRaises(
ValueError, patch, foo_name, new=object(), new_callable=MagicMock
)
self.assertRaises(
ValueError, patch.object, Foo, 'f', new=object(),
new_callable=MagicMock
) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_new_callable_inherit_for_mocks(self):
class MockSub(Mock):
pass
MockClasses = (
NonCallableMock, NonCallableMagicMock, MagicMock, Mock, MockSub
)
for Klass in MockClasses:
for arg in 'spec', 'spec_set':
kwargs = {arg: True}
... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def __init__(self, spec):
self.spec = spec | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_new_callable_class_decorating(self):
test = self
original = Foo
class SomeTest(object):
def _test(self, mock_foo):
test.assertIsNot(Foo, original)
test.assertIs(Foo, mock_foo)
test.assertIsInstance(Foo, SomeClass)
... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test():
self.assertIs(Foo, original_foo)
self.assertEqual(Foo.f, 3)
self.assertEqual(Foo.g, 4) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_multiple_no_kwargs(self):
self.assertRaises(ValueError, patch.multiple, foo_name)
self.assertRaises(ValueError, patch.multiple, Foo) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test(f, foo):
self.assertIs(Foo, original_foo)
self.assertIs(Foo.f, f)
self.assertEqual(Foo.g, 3)
self.assertIs(Foo.foo, foo)
self.assertTrue(is_instance(f, MagicMock))
self.assertTrue(is_instance(foo, MagicMock)) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_multiple_create_mocks_different_order(self):
# bug revealed by Jython!
original_f = Foo.f
original_g = Foo.g
patcher = patch.object(Foo, 'f', 3)
patcher.attribute_name = 'f'
other = patch.object(Foo, 'g', DEFAULT)
other.attribute_name = 'g'
... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test1(g, **kwargs):
_test(g, **kwargs) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test2(g, **kwargs):
_test(g, **kwargs) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test3(g, **kwargs):
_test(g, **kwargs) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def test_patch_multiple_create_mocks_patcher(self):
original_foo = Foo
original_f = Foo.f
original_g = Foo.g
patcher = patch.multiple(foo_name, f=DEFAULT, g=3, foo=DEFAULT)
result = patcher.start()
try:
f = result['f']
foo = result['foo']
... | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
def _test(self, f, foo):
test.assertIs(Foo, original_foo)
test.assertIs(Foo.f, f)
test.assertEqual(Foo.g, 3)
test.assertIs(Foo.foo, foo)
test.assertTrue(is_instance(f, MagicMock))
test.assertTrue(is_instance(foo, MagicMock)) | FFMG/myoddweb.piger | [
16,
2,
16,
2,
1456065110
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.