pytest参数无法识别解析的参数

时间:2019-06-07 12:19:19

标签: python pytest

我需要将返回的列表解析为不起作用的参数标记

List<EditText> list = new ArrayList<EditText>();
List<EditText> list1 = new ArrayList<EditText>();

  add_row.setOnClickListener((v) -> {
            TableRow row = new TableRow(Database.this);
            row.addView(des());
            row.addView(amt());
            t1.addView(row);
        });

  insert.setOnClickListener((v) -> {
        try {
            String strDate = s.date();
            String des = "";
            int amt = 0;

            for(int i=0;i<list.size();i++) {

                for (EditText text2 : list) {
                    des=text2.getText().toString();
                    System.out.println("Strings:" + sb1);
                    break;
                }

                for (EditText text1 : list1) {
                    amt = Integer.parseInt(text1.getText().toString());
                    System.out.println("inte:" + amt);
                    break;
                }

                if(b=s.insert(strDate,des,amt))
                    b=true;/* When b=true the values inserted successfully*/
                else
                    b=false;
            }

    public EditText des() {

    EditText et1 = new EditText(Database.this);
    et1.setTextSize(15);
    et1.setGravity(Gravity.CENTER);
    list.add(et1);
    return et1;

    }

    public EditText amt() {

    EditText et2 = new EditText(Database.this);
    et2.setTextSize(15);
    et2.setGravity(Gravity.CENTER);
    et2.setInputType(InputType.TYPE_CLASS_NUMBER);
    list1.add(et2);
    return et2;

    }

   public class sql extends SQLiteOpenHelper {
       public Boolean insert(String date, String srr, int amt) {
    Boolean b=false;
    SQLiteDatabase s = this.getWritableDatabase();
    ContentValues cv = new ContentValues();
    cv.put("Date", date);
    cv.put("Description", String.valueOf(srr));
    cv.put("Amount", String.valueOf(amt));

    long row = s.insert("data", null, cv);

    if (row == -1)
        return false;
    else
        return true;
     }
}

它只是抛出错误...

@pytest.yield_fixture()
def elements():
    """
    This function helps us to fetch a list
    """
    return [1,2,3]

@pytest.mark.parametrize("ele", ids=elements)
def test_check(ele):
    print(ele)

如何将列表解析为参数对象?

0 个答案:

没有答案