草庐IT

statistical-test

全部标签

python - Windows 上的 TensorFlow 版本 1.0.0-rc2 : "OpKernel (' op: "BestSplits" device_type: "CPU"') for unknown op: BestSplits"with test code

我在Windows7SP1x64Ultimate(Python3.5.2|Anacondacustom(64-bit))上安装了TensorFlow版本1.0.0-rc2,使用:pipinstall--upgradehttps://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.0rc2-cp35-cp35m-win_amd64.whl当我尝试从https://web.archive.org/web/20170214034751/https://www.tensorflow.org/get_started/os_

python - Django py.test 找不到设置模块

我确实有以下项目结构base__init.pysettings__init__.pysettings.pytestspytest.initest_module.py我的pytest.ini看起来像这样:[pytest]#DJANGO_SETTINGS_MODULE=base.settings.settings我的test_module.py看起来像这样:deftest_django():frombase.settingsimportsettingsasbase_settingsfromdjango.confimportsettingsasdjango_settingsassert3==

python -m SimpleHTTPServer - 监听 0.0.0.0 :8000 but http://0. 0.0.0 :8000/test. html 给出 "Page Not Found"

进入我的文件夹后,我进入python-mSimpleHTTPServer得到ServingHTTPon0.0.0.0port8000...回复。但是当我点击http://0.0.0.0:8000/test.html时,我得到一个找不到页面的错误。我也试过了pushd/path/you/want/to/serve;python-mSimpleHTTPServer;popd取自thisquestion当我点击ls时,我可以看到文件和目录。有谁知道我做错了什么? 最佳答案 我认为其他两个答案试图表明0.0.0.0不是您应该访问的URL。当

python - 使用 docstrings 列出 py.test 中的测试

这是一个简单的测试文件:#test_single.pydeftest_addition():"Twoplustwoisstillfour"assert2+2==4deftest_addition2():"Oneplusoneisstilltwo"assert1+1==2py.test中的默认输出是这样的$py.testtest_single.py-v[...]test_single.py::test_additionPASSEDtest_single.py::test_addition2PASSED我想要TwoplustwoisstillfourPASSEDOneplusoneisst

python - "unit tests have failed"for beautifulsoup

我正在尝试为python33安装beautifulsoup,但它没有正确安装,它会给出如下错误:C:\Python33>pipinstallbeautifulsoupDownloading/unpackingbeautifulsoupDownloadingBeautifulSoup-3.2.1.tar.gzRunningsetup.pyegg_infoforpackagebeautifulsoupTraceback(mostrecentcalllast):File"",line16,inFile"c:\windows\temp\pip_build_Prashant\beautifuls

python - 值错误 : no such test method in <class 'myapp.tests.SessionTestCase' >: runTest

我有一个测试用例:classLoginTestCase(unittest.TestCase):...我想在不同的测试用例中使用它:classEditProfileTestCase(unittest.TestCase):def__init__(self):self.t=LoginTestCase()self.t.login()这引发了:ValueError:nosuchtestmethodin我查看了调用异常的单元测试代码,看起来测试不应该以这种方式编写。有没有一种标准的方法来编写你想要测试的东西,以便以后的测试可以重用它?或者有什么解决方法?我现在向LoginTest添加了一个空的ru

python - sklearn train_test_split;保留训练集中列中的唯一值

有没有办法使用sklearn.model_selection.train_test_split保留训练集中特定列的所有唯一值。让我举个例子。我知道的最常见的矩阵分解问题是预测用户在NetflixChallenge中所说的电影评分。或Movielens数据集。现在这个问题并不真正围绕任何单一的矩阵分解方法,但在可能的范围内,有一个小组将只对已知的用户和项目组合进行预测。例如,在Movielens100k中,我们有943个独立用户和1682个独立电影。如果我们使用train_test_split即使train_size比率很高(比如0.9),唯一用户和电影的数量也不会相同。这带来了一个问题

python - 如何在 py.test 中显示警告

我刚刚跑了py.test在我的代码上并得到以下输出:==================6passed,2pytest-warningsin40.79seconds=======================但是,我看不到py.test想要警告我什么。如何打开控制台的警告输出?py.test--help为我提供了--strict标志:--strictrunpytestinstrictmode,warningsbecomeerrors.但是我只想查看输出,而不是让我的测试失败。我检查了pytest.org和thisquestion但他们只关心在python中断言警告,而不是显示在命令行

python - 如何针对不同版本的 python 运行 py.test?

是否可以在没有插件(如xdist)或tox的情况下使用不同版本的python运行py.test? 最佳答案 最简单的方法是直接用-m运行pytest模块,例如:python2.6-mpytest请注意,您必须为那个版本的Python安装pytest。此外,您还需要安装用于该版本Python的所有pytest插件。 关于python-如何针对不同版本的python运行py.test?,我们在StackOverflow上找到一个类似的问题: https://sta

python - 应该 pytest 等人。进入 tests_require[] 或 extras_require{testing[]}?

我正在编写一个使用py.test进行测试的python程序,现在一个测试也依赖于numpy。我应该在setup.py的哪个位置添加这些依赖项?目前我的setup.py的相关部分如下所示:[...]'version':'0.0.1','install_requires':[],'tests_require':['pytest'],'cmdclass':{'test':PyTest},'extras_require':{'testing':['pytest'],},[...]有两次pytest感觉已经有些奇怪了,我不确定在哪里添加numpy。 最佳答案