GVKun编程网logo

nbconvert 后设置 Jupiter 笔记本 toc 侧边栏的宽度

1

对于nbconvert后设置Jupiter笔记本toc侧边栏的宽度感兴趣的读者,本文将会是一篇不错的选择,并为您提供关于AndroidStudio无法解析:org.junit.jupiter:juni

对于nbconvert 后设置 Jupiter 笔记本 toc 侧边栏的宽度感兴趣的读者,本文将会是一篇不错的选择,并为您提供关于Android Studio 无法解析:org.junit.jupiter:junit-jupiter:、Junit-jupiter-api 和 junit-jupiter-engine 的区别是什么、junit-jupiter-api和junit-jupiter-engine之间的区别、jupyter nbconvert --to html_toc 不工作将带有目录的 jupyter notebook 转换为网站格式的有用信息。

本文目录一览:

nbconvert 后设置 Jupiter 笔记本 toc 侧边栏的宽度

nbconvert 后设置 Jupiter 笔记本 toc 侧边栏的宽度

如何解决nbconvert 后设置 Jupiter 笔记本 toc 侧边栏的宽度

nbconvert --to html_toc 后,会显示一个toc 侧边栏,其宽度远大于任何文本。我可以在 html 中调整它的大小,但每次打开它时都必须这样做。有没有办法将默认宽度设置为自动?

Android Studio 无法解析:org.junit.jupiter:junit-jupiter:

Android Studio 无法解析:org.junit.jupiter:junit-jupiter:

如何解决Android Studio 无法解析:org.junit.jupiter:junit-jupiter:

当我尝试同步我的项目或运行单元测试时,它向我显示以下错误:Failed to resolve: org.junit.jupiter:junit-jupiter: Affected Modules: app 这些是我的依赖项:

  1. plugins {
  2. id ''com.android.application''

}

安卓{ 编译SDK版本30 构建工具版本“30.0.3”

  1. defaultConfig {
  2. applicationId "com.example.catalyst"
  3. minSdkVersion 23
  4. targetSdkVersion 30
  5. versionCode 1
  6. versionName "1.0"
  7. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
  8. }
  9. buildTypes {
  10. release {
  11. minifyEnabled false
  12. proguardFiles getDefaultProguardFile(''proguard-android-optimize.txt''),''proguard-rules.pro''
  13. }
  14. }
  15. compileOptions {
  16. sourceCompatibility JavaVersion.VERSION_1_8
  17. targetCompatibility JavaVersion.VERSION_1_8
  18. }

}

依赖项{

  1. implementation ''androidx.appcompat:appcompat:1.2.0''
  2. implementation ''com.google.android.material:material:1.3.0''
  3. implementation ''androidx.constraintlayout:constraintlayout:2.0.4''
  4. implementation ''com.google.android.gms:play-services-maps:17.0.1''
  5. testImplementation ''org.junit.jupiter:junit-jupiter-api:5.4.0''
  6. testImplementation ''org.junit.jupiter:junit-jupiter-engine:5.4.0''
  7. testImplementation ''org.junit.platform:junit-platform-launcher:1.0.0''
  8. androidTestImplementation ''androidx.test.ext:junit:1.1.2''
  9. androidTestImplementation ''androidx.test.espresso:espresso-core:3.3.0''
  10. implementation ''com.journeyapps:zxing-android-embedded:3.4.0''
  11. androidTestImplementation ''org.junit.jupiter:junit-jupiter''
  12. androidTestImplementation ''org.testng:testng:6.9.6''

}

Junit-jupiter-api 和 junit-jupiter-engine 的区别是什么

Junit-jupiter-api 和 junit-jupiter-engine 的区别是什么

我们都知道 JUnit 是用于进行单元测试的。但是 Junit 5 和 Junit 4 的区别比较大。

很多时候你可能会遇到 Junit 引擎配置错误导致测试无法进行。

junit-jupiter-api
JUnit 5 Jupiter API 的测试,你需要使用这个 API 来写测试和进行扩展。

junit-jupiter-engine
JUnit 5 的测试引擎,从 Junit 5 开始,Junit 使用 jupiter 来作为测试引擎。在运行时(runtime)的时候,你需要使用这个引擎来进行测试。

junit-vintage-engine
针对 Junit 5 以下的版本,包括 Junit 4 和 3,Junit 使用的是 vintage 测试引擎。

如果你的测试使用的是 Junit 4 的代码进行编写的话,那么你需要 Junit 4 的测试引擎。

总结

  • 你需要 junit-jupiter-apijunit-jupiter-engine 来在 Junit 5 中书写和运行测试。

因此,你需要在你的 POM 中定义上面 2 个 Package。

针对老的 JUnit 4 的的项目,你需要将 junit-jupiter-engine 引擎替换为 junit-vintage-engine 引擎才能够让你的测试正式跑起来。

https://www.ossez.com/t/junit-jupiter-api-junit-jupiter-engine/579

junit-jupiter-api和junit-jupiter-engine之间的区别

junit-jupiter-api和junit-jupiter-engine之间的区别

Maven模块junit-jupiter-api和之间有什么区别junit-jupiter-engine?是否需要在其中包含两个依赖项build.gradle

我需要写两个依赖吗

testCompile("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")testCompile("org.junit.jupiter:junit-jupiter-api:${junitVersion}")

要么

testCompile("org.junit.jupiter:junit-jupiter-engine:${junitVersion}")

足够?

我是否需要增加对的依赖junit-vintage-engine

答案1

小编典典

5.4之前的JUnit

从文档:

junit-jupiter-api

JUnit Jupiter API,用于编写测试和扩展。

junit-jupiter-engine

JUnit Jupiter测试引擎实现,仅在运行时需要。

junit-vintage-engine

JUnit Vintage测试引擎实现,允许在新的JUnit Platform上运行Vintage JUnit测试,即以JUnit 3或JUnit
4样式编写的测试。

所以…

  • 您同时需要junit-jupiter-apijunit-jupiter-engine来编写和运行JUnit5测试
  • 仅在以下情况下才需要:junit-vintage-engine(a)与JUnit5一起运行, 以及 (b)测试用例使用JUnit4构造/注释/规则等

从5.4版开始的JUnit

在JUnit5.4中,这已简化,请参见下方答案以获取更多详细信息。

答案2

小编典典

junit-jupiter 神器

如果您打算编写JUnit 5测试,则JUnit 5.4提供了更为简单的Maven配置。只需指定名为的聚合工件即可junit-jupiter

<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter --><dependency>    <groupId>org.junit.jupiter</groupId>    <artifactId>junit-jupiter</artifactId>    <version>5.4.2</version>    <scope>test</scope></dependency>

为了方便起见,此聚合工件又自动拉出以下三个工件:

  • junit-jupiter-api (编译依赖项)
  • junit-jupiter-params (编译依赖项)
  • junit-jupiter-engine (运行时依赖项)

在您的项目中,您还将最终得到:

  • junit-platform-commons-1.4.0.jar
  • junit-platform-engine-1.4.0.jar
    以上就是您需要基于新的Jupiter范例编写和运行JUnit 5测试的条件。

旧版测试
如果你的项目中有JUnit 3或4周的测试要继续运行,再添依赖的JUnit的老式发动机,junit-vintage-engine。请参阅IBM的教程。

<!-- https://mvnrepository.com/artifact/org.junit.vintage/junit-vintage-engine --><dependency>    <groupId>org.junit.vintage</groupId>    <artifactId>junit-vintage-engine</artifactId>    <version>5.4.2</version>    <scope>test</scope></dependency>

jupyter nbconvert --to html_toc 不工作将带有目录的 jupyter notebook 转换为网站格式

jupyter nbconvert --to html_toc 不工作将带有目录的 jupyter notebook 转换为网站格式

如何解决jupyter nbconvert --to html_toc 不工作将带有目录的 jupyter notebook 转换为网站格式

我想要的

使用 nbextension toc,jupyter 笔记本具有内容表功能,据说可以通过 nbconvert --to html_toc function 或通过下拉菜单“使用 toc 下载为 html”转移到 html。但是,在我的情况下,这两个选项都不起作用。

我尝试了什么

  1. 使用 toc 下载为 html 最初给出类似于 TemplateNotFound: toc2 的错误
  2. 所有推荐的命令,如 jupyter nbconvert FILE.ipynb --template toc jupyter nbconvert FILE.ipynb --template toc2(这两个看起来不完整,但是是这样提供的) jupyter nbconvert --to html_toc FILE.ipynb(通过菜单与上面相同的错误)
  3. 由于提到了 here 和 here toc2.tpl 文件,我将此文件与 main.css 和 toc2.js 文件放在与要转换的 ipynb notebook 相同的目录中。现在下载为带有 toc menue 的 html 给出错误“nbconvert Failed: toc2”,jupyter nbconvert FILE.ipynb --template toc2 给出错误“jinja2.exceptions.TemplateNotFound: toc2” 我还是没明白toc2模板的作用。它(仍然)有必要吗?为什么?如何(与其他文件?)?在哪里(如何提供位置)?在何处以及如何使用这种极其有用的功能究竟需要什么?
  4. 提到的 here 降级是不可能的,因为导致不兼容。

conda 虚拟环境中使用的条件/版本

(如果您需要更多信息,请告诉我)

  1. jupyter core : 4.7.1
  2. jupyter-notebook : 6.2.0
  3. qtconsole : 5.0.2
  4. ipython : 7.20.0
  5. ipykernel : 5.3.4
  6. jupyter client : 6.1.7
  7. jupyter lab : 3.0.8
  8. nbconvert : 6.0.7
  9. ipywidgets : 7.6.3
  10. nbformat : 5.1.2
  11. traitlets : 5.0.5

关于nbconvert 后设置 Jupiter 笔记本 toc 侧边栏的宽度的问题我们已经讲解完毕,感谢您的阅读,如果还想了解更多关于Android Studio 无法解析:org.junit.jupiter:junit-jupiter:、Junit-jupiter-api 和 junit-jupiter-engine 的区别是什么、junit-jupiter-api和junit-jupiter-engine之间的区别、jupyter nbconvert --to html_toc 不工作将带有目录的 jupyter notebook 转换为网站格式等相关内容,可以在本站寻找。

本文标签: