예제 #1
0
 def with_class_and_partial_match(model_class, instances):
     matches = list(
         utilities.match(
             model_class,
             kind='spam',
         )
     )
     expect(len(matches)) == 2
     for instance in matches:
         expect(instance.kind) == 'spam'
         expect(instances).contains(instance)
예제 #2
0
 def with_self_string_and_partial_match(model_class, instances):
     matches = list(
         utilities.match(
             "data/{self.kind}/{self.key}.yml",
             (lambda key, kind: model_class(kind, key, test="test")),
             kind='egg',
         )
     )
     expect(len(matches)) == 2
     for instance in matches:
         expect(instance.kind) == 'egg'
         expect(instances).contains(instance)
예제 #3
0
 def with_class_and_no_factory(model_class, instances):
     matches = list(
         utilities.match(
             model_class,
             kind='spam',
             key='foo',
         )
     )
     expect(len(matches)) == 1
     instance = matches[0]
     expect(instance.kind) == 'spam'
     expect(instance.key) == 'foo'
     expect(instances).contains(instance)
예제 #4
0
 def with_self_string(model_class, instances):
     matches = list(
         utilities.match(
             "data/{self.kind}/{self.key}.yml",
             (lambda key, kind: model_class(kind, key, test="test")),
             kind='spam',
             key='bar',
         )
     )
     expect(len(matches)) == 1
     instance = matches[0]
     expect(instance.kind) == 'spam'
     expect(instance.key) == 'bar'
     expect(instances).contains(instance)
예제 #5
0
 def with_class_and_factory(model_class, instances):
     matches = list(
         utilities.match(
             model_class,
             (lambda key, kind: model_class(kind, key, test="test")),
             kind='spam',
             key='foo',
         )
     )
     expect(len(matches)) == 1
     instance = matches[0]
     expect(instance.kind) == 'spam'
     expect(instance.key) == 'foo'
     expect(instances).contains(instance)
예제 #6
0
 def it_is_not_yet_implemented():
     with expect.raises(NotImplementedError):
         utilities.match(Mock)
예제 #7
0
 def match(cls, *args, **kwargs):
     return utilities.match(cls, *args, **kwargs)
예제 #8
0
 def it_is_not_yet_implemented():
     with expect.raises(NotImplementedError):
         utilities.match(Mock)