def test_check_attribute_combinations(): """test for check_attribute_combinations function""" #check_attribute_combinations(obj, zero_or_all=[], at_least_one=[], one_implies_others=[]) a = EmptyClass() a.a = None a.b = None a.c = 1 a.d = 2 a.e = None a.f = 5 assert_equal(check_attribute_combinations(a, zero_or_all=[['a','b']]), None) assert_equal(check_attribute_combinations(a, zero_or_all=[['c','d']]), None) assert_equal(check_attribute_combinations(a, zero_or_all=[['a','b'],['c','d']]), None) assert_raises(ValueError, check_attribute_combinations,a, zero_or_all=[['a','c']]) assert_raises(ValueError, check_attribute_combinations,a, zero_or_all=[['a','b'], ['a','c']]) assert_equal(check_attribute_combinations(a, at_least_one=[['a','c','e']]), None) assert_equal(check_attribute_combinations(a, at_least_one=[['c','d']]), None) assert_equal(check_attribute_combinations(a, at_least_one=[['a','c'],['c']]), None) assert_raises(ValueError, check_attribute_combinations, a, at_least_one=[['a','b','e']]) assert_raises(ValueError, check_attribute_combinations, a, at_least_one=[['a','c'], ['a','b','e']]) assert_equal(check_attribute_combinations(a, one_implies_others=[['c','d']]), None) assert_equal(check_attribute_combinations(a, one_implies_others=[['a','b']]), None) assert_equal(check_attribute_combinations(a, one_implies_others=[['a','b'],['c','d','f']]), None) assert_raises(ValueError, check_attribute_combinations, a, one_implies_others=[['c','a']]) assert_raises(ValueError, check_attribute_combinations, a, one_implies_others=[['c','d','e']]) assert_raises(ValueError, check_attribute_combinations, a, one_implies_others=[['c','d'], ['c','d','e']])