我在同一java文件中有两个类文件。我该如何在def plot_stats_test(feature,label_rotation=False,horizontal_layout=True):
temp = df_test_2[feature].value_counts()
df1 = pd.DataFrame({feature: temp.index,'Количество клиентов': temp.values})
# Расчет доли target=1 в категории
cat_perc = df_train_2[[feature, Target']].groupby([feature],as_index=False).mean()
if(horizontal_layout):
fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(12,6))
else:
fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(12,14))
sns.set_color_codes("pastel")
s = sns.barplot(ax=ax1, x = feature, y="Количество клиентов",data=df1)
if(label_rotation):
s.set_xticklabels(s.get_xticklabels(),rotation=90)
plt.tick_params(axis='both', which='major', labelsize=12)
s = sns.barplot(ax=ax2, x = feature, y='Target', data=cat_perc, order=cat_perc[feature])
if(label_rotation):
s.set_xticklabels(s.get_xticklabels(),rotation=90)
plt.ylabel('Доля продленных', fontsize=10)
plt.tick_params(axis='both', which='major', labelsize=10)
plt.show();
类列表中同时调用它们?例如,我有两个类A和B,而Java文件名显然是testng.xml
,其中A是类。如何从A.java
答案 0 :(得分:0)
您基本上会使用$
符号来引用内部类。
假设您有一个示例,如下所示
package com.rationaleemotions.stackoverflow.qn53476365;
import org.testng.annotations.Test;
public class SampleClass {
@Test
public void testMethod() {
System.err.println("Hello from SampleClass");
}
public static class InnerClass {
@Test
public void testMethod() {
System.err.println("Hello from InnerClass");
}
}
}
您将在InnerClass
文件中参考如下所示的testng.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="53476365_Suite" parallel="false" verbose="2">
<test name="53476365_Test">
<classes>
<class name="com.rationaleemotions.stackoverflow.qn53476365.SampleClass"/>
<class name="com.rationaleemotions.stackoverflow.qn53476365.SampleClass$InnerClass"/>
</classes>
</test>
</suite>
输出如下
...
... TestNG 7.0.0-beta1 by Cédric Beust (cedric@beust.com)
...
Hello from SampleClass
Hello from InnerClass
PASSED: testMethod
PASSED: testMethod
===============================================
53476365_Test
Tests run: 2, Failures: 0, Skips: 0
===============================================
===============================================
53476365_Suite
Total tests run: 2, Passes: 2, Failures: 0, Skips: 0
===============================================
Process finished with exit code 0