def test_noop_merge(self): """Test merging a config with an empty 'mml' attribute.""" updates = dict(mml=dict()) with open(self.source) as f: source_data = json.loads(f.read()) result = process_mml(self.source, updates) assert_equal(json.loads(result), source_data)
def test_simple_merge(self): """Test merging a config with an empty 'cartoVars' attribute.""" with codecs.open(self.source, 'r', 'utf-8') as f: source_mss = f.read() result = process_mss(self.source, self.config) lines = result.splitlines() source_lines = source_mss.splitlines() # Make sure we changed something, but that the number of lines is # unchanged assert_not_equal(result, source_mss) assert_equal(len(lines), len(source_lines)) for i, (old, new) in enumerate(zip(source_lines, lines)): # We know there's a variable on this line that has a substitution # in our test config if i == 29: # Make sure we've changed something, but that the new output is # still a valid MSS variable assert_not_equal(old, new) assert_match_regex(MSS_VAR_RE, new) assert_equal( new[-5:-1], self.config.get('cartoVars').get('park') ) else: assert_equal(old, new)
def test_assert_equal(self): assert_equal(1, 1) assert_equal("abc", "abc") assert_equal(self, self)
def test_assert_equal(self): with assert_raises(AssertionError): assert_equal(1, 2)