コード例 #1
0
def step_impl(context, solution):
    """
    :type solution: str
    """
    parsed_ops = parse_operations(solution)
    print(context.solution)
    print(parsed_ops)
    the(parsed_ops).should.have.length(len(context.solution))
    for i in range(len(context.solution)):
        the(context.solution[i]).should.equal(parsed_ops[i])
コード例 #2
0
 def test_where(self):
     result = self.sample2.where({"b": 2}).list().value()
     the(result).should.equal(self.sample2.value())
     result = self.sample2.where({"a": 1}).list().value()
     the(result).should.equal([self.sample2.value()[0]])
コード例 #3
0
 def test_reduce_right(self):
     result = self.sample.reduce_right(lambda t, x: t + x)._
     the(result).should.equal(45)
コード例 #4
0
 def test_each(self):
     r = []
     self.sample.each(lambda x: r.append(x))
     the(self.sample.value()).should.equal(r)
コード例 #5
0
 def test_new(self):
     fake = copy.deepcopy(self.sample)
     the(fake.value()).should.equal(self.sample.value())
     the(fake).should.NOT.equal(self.sample)
コード例 #6
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_sort_by(self):
     t = self.sample.deep_copy()
     result = self.sample.sort_by(key=lambda x: -x).value()
     the(result).should.equal(t.reverse().value())
コード例 #7
0
ファイル: test_the_special_case.py プロジェクト: the-py/the
 def test_be_callable(self):
     self.assertTrue(the(1).be(1))
     with self.assertRaises(AssertionError):
         the(True).should.be(False)
コード例 #8
0
 def test_pluck(self):
     the(self.sample2.pluck("b").list().value()).should.be.equal([2, 2])
コード例 #9
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_map(self):
     result = self.sample.map(lambda x: x+1).list().value()
     the(result).should.equal(list(range(1,11)))
コード例 #10
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_each(self):
     r = []
     self.sample.each(lambda x: r.append(x))
     the(self.sample.value()).should.equal(r)
コード例 #11
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_value(self):
     the(self.sample.value).when.apply().should.have.result(list(range(10)))
コード例 #12
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_new(self):
     fake = copy.deepcopy(self.sample)
     the(fake.value()).should.equal(self.sample.value())
     the(fake).should.NOT.equal(self.sample)
コード例 #13
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_setitem(self):
     s = self.sample.list()
     the(s[0]).should.equal(0)
     s[0] = 1
     the(s[0]).should.equal(1)
コード例 #14
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_getitem(self):
     the(self.sample[0]).should.equal(0)
コード例 #15
0
 def test_reject(self):
     result = self.sample.filter(lambda x: x % 2 == 1).list().value()
     the(result).should.equal(list(range(1, 10, 2)))
コード例 #16
0
 def test_some(self):
     the(self.sample.some(lambda x: x > 4)).should.be.true
     the(self.sample.some(lambda x: x > 10)).should.be.false
コード例 #17
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_reduce_right(self):
     result = self.sample.reduce_right(lambda t, x: t+x)._
     the(result).should.equal(45)
コード例 #18
0
 def test_min(self):
     the(self.sample.min()._).should.be(0)
     the(self.sample.min(lambda x: -x)._).should.be(9)
コード例 #19
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_find_item(self):
     result = self.sample.find_item(lambda x: x == 5)._
     the(result).should.equal(5)
     result = self.sample.find_item(lambda x: x == 11)
     the(result).should.be.none
コード例 #20
0
ファイル: test_the_special_case.py プロジェクト: the-py/the
 def test_a_callable(self):
     self.assertTrue(the("1").should.be.a(str))
     with self.assertRaises(AssertionError):
         the(1).should.be.a(str)
コード例 #21
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_where(self):
     result = self.sample2.where({"b": 2}).list().value()
     the(result).should.equal(self.sample2.value())
     result = self.sample2.where({"a": 1}).list().value()
     the(result).should.equal([self.sample2.value()[0]])
コード例 #22
0
 def test_setitem(self):
     s = self.sample.list()
     the(s[0]).should.equal(0)
     s[0] = 1
     the(s[0]).should.equal(1)
コード例 #23
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_find_where(self):
     result = self.sample2.find_where({"b": 2}).value()
     the(result).should.equal(self.sample2.value()[0])
     result = self.sample2.find_where({"a": 1}).value()
     the(result).should.equal(self.sample2.value()[0])
コード例 #24
0
 def test_value(self):
     the(self.sample.value).when.apply().should.have.result(list(range(10)))
コード例 #25
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_reject(self):
     result = self.sample.filter(lambda x: x%2==1).list().value()
     the(result).should.equal(list(range(1,10,2)))
コード例 #26
0
 def test_map(self):
     result = self.sample.map(lambda x: x + 1).list().value()
     the(result).should.equal(list(range(1, 11)))
コード例 #27
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_all(self):
     the(self.sample.all(lambda x: x > -1)).should.be.true
     the(self.sample.all(lambda x: x > 1)).should.be.false
コード例 #28
0
 def test_find_item(self):
     result = self.sample.find_item(lambda x: x == 5)._
     the(result).should.equal(5)
     result = self.sample.find_item(lambda x: x == 11)
     the(result).should.be.none
コード例 #29
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_some(self):
     the(self.sample.some(lambda x: x > 4)).should.be.true
     the(self.sample.some(lambda x: x > 10)).should.be.false
コード例 #30
0
 def test_find_where(self):
     result = self.sample2.find_where({"b": 2}).value()
     the(result).should.equal(self.sample2.value()[0])
     result = self.sample2.find_where({"a": 1}).value()
     the(result).should.equal(self.sample2.value()[0])
コード例 #31
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_contains(self):
     the(self.sample.contains).when.apply(2).should.have.result(True)
     the(self.sample.contains).when.apply(121).should.have.result(False)
コード例 #32
0
 def test_all(self):
     the(self.sample.all(lambda x: x > -1)).should.be.true
     the(self.sample.all(lambda x: x > 1)).should.be.false
コード例 #33
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_pluck(self):
     the(self.sample2.pluck("b").list().value()).should.be.equal([2,2])
コード例 #34
0
 def test_contains(self):
     the(self.sample.contains).when.apply(2).should.have.result(True)
     the(self.sample.contains).when.apply(121).should.have.result(False)
コード例 #35
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_max(self):
     the(self.sample.max()._).should.be.equal(9)
     the(self.sample.max(lambda x: -x)._).should.be.equal(0)
コード例 #36
0
 def test_max(self):
     the(self.sample.max()._).should.be.equal(9)
     the(self.sample.max(lambda x: -x)._).should.be.equal(0)
コード例 #37
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_min(self):
     the(self.sample.min()._).should.be(0)
     the(self.sample.min(lambda x: -x)._).should.be(9)
コード例 #38
0
 def test_reverse(self):
     the(self.sample.reverse().value()).should.equal(list(range(9, -1, -1)))
コード例 #39
0
ファイル: test_list.py プロジェクト: v2e4lisp/_.py
 def test_reverse(self):
     the(self.sample.reverse().value()).should.equal(list(range(9, -1, -1)))
コード例 #40
0
ファイル: test_the_special_case.py プロジェクト: the-py/the
 def test_the_a(self):
     it = the(1)
     self.assertTrue(isinstance(it.a, _TheA))
     self.assertEqual(it.a.should, it)
コード例 #41
0
 def test_sort_by(self):
     t = self.sample.deep_copy()
     result = self.sample.sort_by(key=lambda x: -x).value()
     the(result).should.equal(t.reverse().value())
コード例 #42
0
ファイル: test_the_special_case.py プロジェクト: the-py/the
 def test_the_be(self):
     it = the(1)
     self.assertTrue(isinstance(it.be, _TheBe))
     self.assertEqual(it.be.should, it)
コード例 #43
0
 def test_getitem(self):
     the(self.sample[0]).should.equal(0)