コード例 #1
0
    def test_sequence_with_custom_function(self):
        label = "t %s"
        Factory.define(Tomato, number=Factory.sequence(lambda x: label % x))

        assert_equals(label % 1, Factory(Tomato).number)
        assert_equals(label % 2, Factory(Tomato).number)
        assert_equals(label % 3, Factory(Tomato).number)
コード例 #2
0
    def test_sequence_with_custom_start(self):
        start = 100
        Factory.define(Tomato, number=Factory.sequence(start=start))

        assert_equals(start + 1, Factory(Tomato).number)
        assert_equals(start + 2, Factory(Tomato).number)
        assert_equals(start + 3, Factory(Tomato).number)
コード例 #3
0
    def test_sequence(self):
        Factory.define(Tomato, number=Factory.sequence())

        assert_equals(1, Factory(Tomato).number)
        assert_equals(2, Factory(Tomato).number)
        assert_equals(3, Factory(Tomato).number)