Python mox urllib2的Request和urllopen函数

时间:2017-09-14 08:17:06

标签: python unit-testing mox

我正试图mo

self.mox.StubOutWithMock(urllib2, "Request")
self.mox.StubOutWithMock(urllib2, "urlopen")
res = self.mox.CreateMockAnything(urllib2.Request)
urllib2.Request(IgnoreArg(), IgnoreArg(), IgnoreArg()).AndReturn(req).AndReturn(res)

有人可以帮我写这个mox测试吗?我正在尝试跟随

urllib2.Request(IgnoreArg(), IgnoreArg(), IgnoreArg()).AndReturn(req).AndReturn(res)
raise TypeError('Not callable')
TypeError: Not callable

但抛出错误

<tr ng-repeat="student in tabledata">
  <td>{{student.RollNumber}}</td>
  <td>{{student.StudentName}}</td>
  <td ng-repeat="item in Allsubjects">
    <div ng-repeat="enable in student.subjectArray">
      <input type="text" 
             class="form-control" 
             ng-model="SubjectMark" 
             ng-change="internal(item.Id,student.StudentId,SubjectMark)" 
             ng-disabled="item.Elective ==='Optional'&& enable.opted != item.Id" 
             required>
    </div>
  </td>
</tr>

0 个答案:

没有答案