def test_compile_swapped_coords(self): tags = compile_tags(txt2tags("20\n2.2\n10\n1.1")) assert tags[0] == (20, 2.2), "expected coords as single tags" assert tags[1] == (10, 1.1), "expected coords as single tags"
def test_row_count(self, model): assert model.rowCount() == len(compile_tags(self.tags()))
def test_compile_single_group_code_10(self): tags = compile_tags(txt2tags("10\n1.1")) assert tags[0] == (10, 1.1)
def test_compile_two_group_code_10(self): tags = compile_tags(txt2tags("10\n1.1\n10\n2.2")) assert tags[0] == (10, 1.1) assert tags[1] == (10, 2.2)
def test_compile_single_3d_point(self): tags = compile_tags(txt2tags("10\n1.2\n20\n2.3\n30\n3.4")) assert tags[0] == (10, (1.2, 2.3, 3.4))
def test_compile_nan_coords_3d(self): tags = compile_tags(txt2tags("10\n1\n20\n2\n30\nx")) assert math.isnan(tags[0].value[2])
def test_compile_two_2d_points(self): tags = compile_tags(txt2tags("10\n1.1\n20\n1.2\n10\n2.1\n20\n2.2")) assert tags[0] == (10, (1.1, 1.2)) assert tags[1] == (10, (2.1, 2.2))
def test_compile_nan_coords_2d(self): tags = compile_tags(txt2tags("10\nx.2\n20\n2.3")) assert math.isnan(tags[0].value[0])
def test_compile_single_2d_point(self): tags = compile_tags(txt2tags("10\n1.2\n20\n2.3")) assert tags[0] == (10, (1.2, 2.3))
def test_compile_invalid_float_to_str(self): tags = compile_tags(txt2tags("40\nx.14")) assert tags[0] == (40, "x.14")
def test_compile_single_float(self): tags = compile_tags(txt2tags("40\n3.14")) assert tags[0] == (40, 3.14)
def test_compile_invalid_int_to_str(self): tags = compile_tags(txt2tags("70\nx")) assert tags[0] == (70, "x")
def test_compile_single_int(self): tags = compile_tags(txt2tags("70\n3")) assert tags[0] == (70, 3)