def test_dotted_values_work(self): """Test that we can use dotted values as the keys.""" prop_file = StringIO("ro.product.model=maguro") properties = platform._parse_build_properties_file(prop_file) self.assertThat(properties, Equals({'ro.product.model': 'maguro'}))
def test_multiple_values(self): """Test several expressions over multiple lines.""" prop_file = StringIO("a=b\nb=23") properties = platform._parse_build_properties_file(prop_file) self.assertThat(properties, Equals(dict(a='b', b='23')))
def test_values_with_equals_in_them(self): """Test that we can parse values with a '=' in them.""" prop_file = StringIO("a=b=c") properties = platform._parse_build_properties_file(prop_file) self.assertThat(properties, Equals(dict(a='b=c')))
def test_simple_value(self): """Test a simple a=b expression.""" prop_file = StringIO("a=b") properties = platform._parse_build_properties_file(prop_file) self.assertThat(properties, Equals(dict(a='b')))
def test_invalid_lines_are_ignored(self): """lines without ana ssignment must be ignored.""" prop_file = StringIO("Hello") properties = platform._parse_build_properties_file(prop_file) self.assertThat(len(properties), Equals(0))
def test_comments_are_ignored(self): """Comments in build file must be ignored.""" prop_file = StringIO("# Hello World\n #Hello Again\n#####") properties = platform._parse_build_properties_file(prop_file) self.assertThat(len(properties), Equals(0))
def test_whitespace_is_ignored(self): """Whitespace in build file must be ignored.""" prop_file = StringIO("\n\n\n\n\n") properties = platform._parse_build_properties_file(prop_file) self.assertThat(len(properties), Equals(0))
def test_empty_file_returns_empty_dictionary(self): """An empty file must result in an empty dictionary.""" prop_file = StringIO("") properties = platform._parse_build_properties_file(prop_file) self.assertThat(len(properties), Equals(0))