# -*- coding: utf-8 -*-

from ddf_utils.chef.helpers import gen_query


def test_gen_query():
    cond = {'$and': {'year': {'$gt': 1990, '$lt': 2000}}}
    cond = {'$not': {'year': {'$ne': 1990, '$lt': 2000}}}
    cond = {'$nor': {'year': {'$ne': 1990, '$lt': 2000}}}
    gen_query(cond)

@@ -18,16 +18,55 @@
 -8 -*-%0A%0A
+import numpy as np%0Aimport pandas as pd%0A
 from ddf
@@ -101,16 +101,25 @@
 en_query
+, sort_df
 %0A%0A%0Adef t
@@ -305,24 +305,24 @@
 t': 2000%7D%7D%7D%0A
-
     gen_quer
@@ -329,8 +329,495 @@
 y(cond)%0A
+%0A%0Adef test_sort_df():%0A    df = pd.DataFrame(np.random.rand(100, 3), columns=%5B'A', 'C', 'B'%5D)%0A    df1 = sort_df(df, 'A')%0A    assert df1.columns.tolist() == %5B'A', 'B', 'C'%5D%0A%0A    df = pd.DataFrame(np.random.rand(100, 4), columns=%5B'D', 'A', 'C', 'B'%5D)%0A    df2 = sort_df(df, %5B'D', 'A'%5D, sort_key_columns=False)%0A    assert df2.columns.tolist() == %5B'D', 'A', 'B', 'C'%5D%0A%0A    df3 = sort_df(df, %5B'D'%5D, custom_column_order=%7B'A': 1, 'C': -1%7D)%0A    assert df3.columns.tolist() == %5B'D', 'C', 'B', 'A'%5D%0A

update tests